-
Notifications
You must be signed in to change notification settings - Fork 26
[Docs] Templates - Ascending navigation update #5653
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 7 commits
248ebe8
71239ae
6b21bc2
1f1e27e
746de12
19d227c
713bbfd
3c65231
8c3dd11
8336d31
70c3ae0
6c35542
dbcfdec
bfc437e
4e6f7c8
37de7d3
1f32531
160cb18
eac9a19
89af502
043c179
a6ba58c
f83f445
f569729
207a0f6
2884f44
1d55c54
9621ba1
92c2cc9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,103 @@ | ||||||||||||||||
| /* eslint-disable react/prop-types */ | ||||||||||||||||
| import React, { useState } from 'react'; | ||||||||||||||||
| import { | ||||||||||||||||
| Anchor, | ||||||||||||||||
| Box, | ||||||||||||||||
| Button, | ||||||||||||||||
| Grommet, | ||||||||||||||||
| Header, | ||||||||||||||||
| Markdown, | ||||||||||||||||
| PageContent, | ||||||||||||||||
| PageHeader, | ||||||||||||||||
| Paragraph, | ||||||||||||||||
| Text, | ||||||||||||||||
| } from 'grommet'; | ||||||||||||||||
| import { hpe } from 'grommet-theme-hpe'; | ||||||||||||||||
| import { Left, Home } from '@hpe-design/icons-grommet'; | ||||||||||||||||
|
|
||||||||||||||||
| import { components } from '../../../components/content/MarkdownComponents'; | ||||||||||||||||
| import { HomeContent } from './components/HomeContent'; | ||||||||||||||||
| import { sectionConfig } from './data/sections'; | ||||||||||||||||
|
|
||||||||||||||||
| export const AscendingNavigationExample = () => { | ||||||||||||||||
| const [activeSection, setActiveSection] = useState('overview'); | ||||||||||||||||
|
||||||||||||||||
| const [activeSection, setActiveSection] = useState('overview'); | |
| const [activePage, setActivePage] = useState('overview'); |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this a configuration or the pages content?
| const config = sectionConfig[activeSection]; | |
| const page = pageContent[activePage]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should not have a Grommet wrapper here.
| <Grommet theme={hpe}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are re-creating how "Example containers" are displayed within the site and creating fragmentation, additional deviation and overhead. Why not just use the Example container's properties for consistency?
| <Box | |
| background="background-back" | |
| width="full" | |
| border={{ color: 'border-weak', size: 'xsmall' }} | |
| pad={{ bottom: 'xlarge' }} | |
| > | |
| <> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replaced custom box container with example.
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The screen reader will read out both "Go to Home page" and the icon's aria-label "Home". Which is redundant and confusing. Need to suppress the latter.
| icon={<Home />} | |
| icon={<Home aria-hidden="true" />} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is unnecessary.
| hoverIndicator="background" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| /* eslint-disable react/prop-types */ | ||
| import { Paragraph, Grid } from 'grommet'; | ||
| import { SectionCard } from './SectionCard'; | ||
| import { sections } from '../data/sections'; | ||
|
|
||
| export const HomeContent = ({ onNavigate }) => ( | ||
| <> | ||
| <Paragraph> | ||
| Use the navigation in the header or the cards below to explore different | ||
| sections of this demo app. While on any nested page the{' '} | ||
| <strong>Ascending navigation</strong> will bring you home. | ||
|
||
| </Paragraph> | ||
| <Grid columns="small" gap="small"> | ||
| {sections.map(section => ( | ||
| <SectionCard key={section.id} section={section} onClick={onNavigate} /> | ||
| ))} | ||
| </Grid> | ||
| </> | ||
| ); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| /* eslint-disable react/prop-types */ | ||
| import { Button } from 'grommet'; | ||
|
|
||
| export const NavigationButton = ({ section, isActive, onClick }) => ( | ||
| <Button | ||
| default | ||
| icon={section.icon} | ||
| label={section.label} | ||
| active={isActive} | ||
| onClick={() => onClick(section.id)} | ||
| /> | ||
| ); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| /* eslint-disable react/prop-types */ | ||
| import { Card, Box, Heading, Paragraph } from 'grommet'; | ||
| import { LinkNext } from '@hpe-design/icons-grommet'; | ||
|
|
||
| export const SectionCard = ({ section, onClick }) => ( | ||
| <Card default onClick={() => onClick(section.id)} pad="xsmall"> | ||
| <Box direction="row" fill justify="between"> | ||
| <Heading | ||
| level="2" | ||
| margin={{ | ||
| horizontal: 'none', | ||
| vertical: '3xsmall', | ||
| }} | ||
| > | ||
| {section.label} | ||
| </Heading> | ||
| <LinkNext height="xxlarge" /> | ||
| </Box> | ||
|
|
||
| <Paragraph> | ||
| This leads to the {section.label} page of your HPE Design System demo app. | ||
| </Paragraph> | ||
| </Card> | ||
| ); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| import { Announce, Help, Template } from '@hpe-design/icons-grommet'; | ||
|
||
|
|
||
| export const sections = [ | ||
| { id: 'overview', label: 'Overview', icon: <Announce size="small" /> }, | ||
| { id: 'components', label: 'Components', icon: <Template size="small" /> }, | ||
| { id: 'help', label: 'Help', icon: <Help size="small" /> }, | ||
| ]; | ||
|
|
||
| export const sectionConfig = { | ||
| home: { label: 'Home', subtitle: 'HPE Design System demo.' }, | ||
| overview: { label: 'Overview', subtitle: 'This is the overview section.' }, | ||
| components: { | ||
| label: 'Components', | ||
| subtitle: 'This is the components section.', | ||
| }, | ||
| help: { label: 'Help', subtitle: 'This is the help section.' }, | ||
| }; | ||
|
Comment on lines
+3
to
+31
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @julauxen - How did we arrive at the content this example is displaying? I don't see the new content documented in the issue. Only a reference to replace static images. Historically we have tried to author content which is more representative of the real world scenarios consumers of the HPE Design System will be encountering so that it is more recognizable and relatable. One of the key things this example needs to communicate is the parent-child relationship and the associated navigation. I'm not sure the Home page use case is the most compelling or representative for the concepts we want to communicate.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @halocline I'll take accountability for forging ahead with code before agreeing upon content. Ive updated to use a similar pattern to the previous image example @julauxen we can decide if i should remove additional pages or choose suitable content (which will be easy now that the frame work is solid)
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sorry I missed this comment, thanks for adjusting the content, both here and after our syncs |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| export * from './AscendingNavigationAnatomy'; | ||
| export * from './AscendingNavigationExample'; |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,59 +1,55 @@ | ||||||
| import { DiagramPreview, Example } from '../../layouts'; | ||||||
| import { AscendingNavigationAnatomy } from '../../examples'; | ||||||
| import { Example } from '../../layouts'; | ||||||
| import { | ||||||
| AscendingNavigationExample | ||||||
| } from '../../examples'; | ||||||
| import { Text } from 'grommet'; | ||||||
|
|
||||||
| When an application’s hierarchy is well designed, the ascending button will typically take the user | ||||||
| back to the previous page they came from. | ||||||
| The `parent` property on [PageHeader](https://design-system.hpe.design/components/PageHeader) generates a link to the immediate upstream page in the hierarchy. | ||||||
SeamusLeonardHPE marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
|
|
||||||
| <Example | ||||||
| caption="Example of an ascending button." | ||||||
| plain | ||||||
| pad="xsmall" | ||||||
| previewWidth="medium" | ||||||
| height={{ min: 'xsmall' }} | ||||||
| > | ||||||
| <DiagramPreview | ||||||
| src={{ | ||||||
| dark: '/templateImages/ascending-button-preview-invert.svg', | ||||||
| light: '/templateImages/ascending-button-preview.svg', | ||||||
| }} | ||||||
| alt="ascending button in an application" | ||||||
| /> | ||||||
| </Example> | ||||||
|
|
||||||
| ## Guidance | ||||||
|
|
||||||
| - Follows the [default button styling](https://design-system.hpe.design/components/button#default-button) with a "FormPrevious" icon. | ||||||
| - Displayed below the Header and aligned to the left with the pages content. | ||||||
|
|
||||||
| ## When to use | ||||||
|
|
||||||
| - To allow users to return to the parent (hub) screen when on a details (child/spoke) page. | ||||||
| - To visually communicate the parent page for the user’s current page. | ||||||
|
|
||||||
| ## Example | ||||||
|
|
||||||
| Ascending Navigation provides an easy way for a user to move from a child page up to a parent page. | ||||||
|
|
||||||
| <Example | ||||||
| caption={ | ||||||
| <> | ||||||
| <Text margin={{ top: 'xsmall' }} size="small"> | ||||||
| {' '} | ||||||
| 1. A preview of Users detail view (child page). | ||||||
| 1. Page loads on <strong>Overview</strong> child page | ||||||
| </Text> | ||||||
| <br></br> | ||||||
|
||||||
| <Text margin={{ top: 'xsmall' }} size="small"> | ||||||
| {' '} | ||||||
| 2. A preview of Ascending Navigation to the parent page utilizing the ascending | ||||||
| button. | ||||||
| 2. Interacting with the <strong>Ascending Navigation</strong> link brings the user to the home page. | ||||||
| </Text> | ||||||
| </> | ||||||
| } | ||||||
| plain | ||||||
| pad="xsmall" | ||||||
| previewWidth="xlarge" | ||||||
| height={{ min: 'xsmall' }} | ||||||
| pad={{ | ||||||
| bottom: "xlarge" | ||||||
| }} | ||||||
| previewWidth="full" | ||||||
| > | ||||||
| <AscendingNavigationAnatomy /> | ||||||
| <AscendingNavigationExample /> | ||||||
| </Example> | ||||||
|
|
||||||
| ```txt | ||||||
|
||||||
| ```txt | |
| ```jsx |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated to jsx
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will need to connect with @britt6612 to help me learn how to add raw code urls via code prop



Uh oh!
There was an error while loading. Please reload this page.