-
Notifications
You must be signed in to change notification settings - Fork 27
[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
Merged
Merged
Changes from 27 commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
248ebe8
Initial commit
SeamusLeonardHPE 71239ae
Removed unused partial
SeamusLeonardHPE 6b21bc2
Removed unnecessary imports
SeamusLeonardHPE 1f1e27e
Merge branch 'master' of github.com:grommet/hpe-design-system into do…
britt6612 746de12
add code changes
britt6612 19d227c
Updates from review
SeamusLeonardHPE 713bbfd
Changed example border to weak
SeamusLeonardHPE 3c65231
Modifed based on PR feedback ascending navigation example
SeamusLeonardHPE 8c3dd11
Modifed based on PR feedback fix
SeamusLeonardHPE 8336d31
Remove unnecessary fragment from HomeContent
SeamusLeonardHPE 70c3ae0
Updated example content
SeamusLeonardHPE 6c35542
Removed unused icon cause build fail
SeamusLeonardHPE dbcfdec
requested edits to example content
SeamusLeonardHPE bfc437e
fixed build fail
SeamusLeonardHPE 4e6f7c8
Added code example in accordian - fixed padding issue
SeamusLeonardHPE 37de7d3
Fixed build error
SeamusLeonardHPE 1f32531
Content update
SeamusLeonardHPE 160cb18
Content update from @julauxen
SeamusLeonardHPE eac9a19
Content update from @julauxen
SeamusLeonardHPE 89af502
Merge branch 'master' of github.com:grommet/hpe-design-system into do…
britt6612 043c179
Merge branch 'master' into docs-ascending-navigation-update
britt6612 a6ba58c
Merge branch 'docs-ascending-navigation-update' of github.com:grommet…
britt6612 f83f445
merge with master
britt6612 f569729
update files
britt6612 207a0f6
Review feedback
SeamusLeonardHPE 2884f44
Updated avatar props to standarize across other examples
SeamusLeonardHPE 1d55c54
Removed redundant size prop, fixed card padding
SeamusLeonardHPE 9621ba1
remove box
britt6612 92c2cc9
Apply suggestion from @britt6612
britt6612 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
85 changes: 0 additions & 85 deletions
85
apps/docs/src/examples/templates/ascending-navigation/AscendingNavigationAnatomy.js
This file was deleted.
Oops, something went wrong.
23 changes: 23 additions & 0 deletions
23
apps/docs/src/examples/templates/ascending-navigation/AscendingNavigationCodeExample.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| /* eslint-disable react/prop-types */ | ||
| import React from 'react'; | ||
| import { Anchor, Button, PageHeader } from 'grommet'; | ||
| import { Left } from '@hpe-design/icons-grommet'; | ||
|
|
||
| export const AscendingNavigationCodeExample = () => { | ||
| return ( | ||
| <PageHeader | ||
| title="Child page title" | ||
| subtitle="Page subtitle goes here. It can be a little bit longer to | ||
| provide more context about the page." | ||
| size="large" | ||
| parent={ | ||
| <Anchor | ||
| label="Home" | ||
| icon={<Left />} | ||
| a11yTitle="Link to the home page" | ||
| /> | ||
| } | ||
| actions={<Button label="Action" primary />} | ||
| /> | ||
| ); | ||
| }; |
45 changes: 45 additions & 0 deletions
45
apps/docs/src/examples/templates/ascending-navigation/AscendingNavigationExample.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| /* eslint-disable react/prop-types */ | ||
| import React, { useState } from 'react'; | ||
| import { Anchor, Box, Button, PageContent, PageHeader } from 'grommet'; | ||
| import { Left } from '@hpe-design/icons-grommet'; | ||
| import { HomeContent } from './components/HomeContent'; | ||
| import { PageOneContent } from './components/PageOneContent'; | ||
| import { PageTwoContent } from './components/PageTwoContent'; | ||
| import { sectionConfig } from './data/sections'; | ||
|
|
||
| export const AscendingNavigationExample = () => { | ||
| const [activePage, setActivePage] = useState('pageOne'); | ||
|
|
||
| const page = sectionConfig[activePage]; | ||
|
|
||
| const sectionContent = { | ||
| home: <HomeContent onNavigate={setActivePage} />, | ||
| pageOne: <PageOneContent onNavigate={setActivePage} />, | ||
| pageTwo: <PageTwoContent onNavigate={setActivePage} />, | ||
| }; | ||
|
|
||
| return ( | ||
| <PageContent gap="xsmall" kind="full"> | ||
| <Box width="xlarge" pad={{ bottom: 'xxlarge' }}> | ||
| <PageHeader | ||
| title={page.label} | ||
| subtitle={page.subtitle} | ||
| size="large" | ||
| parent={ | ||
| activePage !== 'home' ? ( | ||
| <Anchor | ||
| label={sectionConfig.home.label} | ||
| icon={<Left />} | ||
| onClick={() => setActivePage('home')} | ||
| /> | ||
| ) : undefined | ||
| } | ||
| actions={ | ||
| activePage !== 'home' && <Button label={page.action} primary /> | ||
| } | ||
| /> | ||
| <Box gap="small">{sectionContent[activePage]}</Box> | ||
| </Box> | ||
| </PageContent> | ||
| ); | ||
| }; |
18 changes: 18 additions & 0 deletions
18
apps/docs/src/examples/templates/ascending-navigation/components/HomeContent.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| /* eslint-disable react/prop-types */ | ||
| import { Grid } from 'grommet'; | ||
| import { SectionCard } from './SectionCard'; | ||
| import { sectionConfig } from '../data/sections'; | ||
|
|
||
| export const HomeContent = ({ onNavigate }) => ( | ||
| <Grid columns="small" gap="small"> | ||
| {Object.entries(sectionConfig) | ||
| .filter(([key]) => key !== 'home') | ||
| .map(([key, config]) => ( | ||
| <SectionCard | ||
| key={key} | ||
| section={{ id: key, ...config }} | ||
| onClick={onNavigate} | ||
| /> | ||
| ))} | ||
| </Grid> | ||
| ); |
96 changes: 96 additions & 0 deletions
96
apps/docs/src/examples/templates/ascending-navigation/components/PageOneContent.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
| /* eslint-disable react/prop-types */ | ||
| import { useState } from 'react'; | ||
| import { Box, DataTable, Avatar, Text } from 'grommet'; | ||
|
|
||
| const data = [ | ||
| { | ||
| id: 1, | ||
| initials: 'AL', | ||
| name: 'Alex Lee', | ||
| email: 'alex.lee@example.com', | ||
| status: 'Active', | ||
| }, | ||
| { | ||
| id: 2, | ||
| initials: 'SM', | ||
| name: 'Sofia Martinez', | ||
| email: 'sofia.martinez@example.com', | ||
| status: 'Active', | ||
| }, | ||
| { | ||
| id: 3, | ||
| initials: 'JR', | ||
| name: 'Jordan Roberts', | ||
| email: 'jordan.roberts@example.com', | ||
| status: 'Pending', | ||
| }, | ||
| { | ||
| id: 4, | ||
| initials: 'AK', | ||
| name: 'Aisha Khan', | ||
| email: 'aisha.khan@example.com', | ||
| status: 'Inactive', | ||
| }, | ||
| { | ||
| id: 5, | ||
| initials: 'DL', | ||
| name: 'Daniel Lopez', | ||
| email: 'daniel.lopez@example.com', | ||
| status: 'Active', | ||
| }, | ||
| { | ||
| id: 6, | ||
| initials: 'NP', | ||
| name: 'Nina Patel', | ||
| email: 'nina.patel@example.com', | ||
| status: 'Active', | ||
| }, | ||
| { | ||
| id: 7, | ||
| initials: 'MT', | ||
| name: 'Marco Tan', | ||
| email: 'marco.tan@example.com', | ||
| status: 'Pending', | ||
| }, | ||
| ]; | ||
|
|
||
| export const PageOneContent = () => { | ||
| const [selected, setSelected] = useState([]); | ||
|
|
||
| return ( | ||
| <Box> | ||
| <DataTable | ||
| data={data} | ||
| aria-describedby="User management table" | ||
| select={selected} | ||
| onSelect={setSelected} | ||
| columns={[ | ||
| { | ||
| property: 'name', | ||
| header: 'User name', | ||
| primary: true, | ||
| render: datum => ( | ||
| <Box direction="row" gap="small" align="center"> | ||
| <Avatar background="decorative-green"> | ||
| <Text color="text-strong"> | ||
| {datum.initials} | ||
| </Text> | ||
| </Avatar> | ||
| <Text>{datum.name}</Text> | ||
| </Box> | ||
| ), | ||
| }, | ||
| { | ||
| property: 'email', | ||
| header: 'Email', | ||
| }, | ||
| { | ||
| property: 'status', | ||
| header: 'Status', | ||
| render: datum => <Text>{datum.status}</Text>, | ||
| }, | ||
| ]} | ||
| /> | ||
| </Box> | ||
| ); | ||
| }; | ||
110 changes: 110 additions & 0 deletions
110
apps/docs/src/examples/templates/ascending-navigation/components/PageTwoContent.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,110 @@ | ||
| /* eslint-disable react/prop-types */ | ||
| import { useState } from 'react'; | ||
| import { Box, DataTable, Text } from 'grommet'; | ||
|
|
||
| const data = [ | ||
| { | ||
| id: 'id-1', | ||
| displayName: 'Server 1', | ||
| serialNumber: '8899569448808967', | ||
| model: 'Proliant SY 480 Gen10', | ||
| powerState: 'On', | ||
| health: { summary: 'OK' }, | ||
| state: { connected: false }, | ||
| }, | ||
| { | ||
| id: 'id-2', | ||
| displayName: 'Server 2', | ||
| serialNumber: '482148808968', | ||
| model: 'Proliant SY 990 Gen9', | ||
| powerState: 'Off', | ||
| health: { summary: 'Warning' }, | ||
| state: { connected: true }, | ||
| }, | ||
| { | ||
| id: 'id-3', | ||
| displayName: 'Server 3', | ||
| serialNumber: '3890108963', | ||
| model: 'Proliant SY 990 Gen9', | ||
| powerState: 'Off', | ||
| health: { summary: 'Warning' }, | ||
| state: { connected: false }, | ||
| }, | ||
| { | ||
| id: 'id-4', | ||
| displayName: 'Server 4', | ||
| serialNumber: '8508964', | ||
| model: 'Proliant SY 660 Gen10', | ||
| powerState: 'On', | ||
| health: { summary: 'OK' }, | ||
| state: { connected: true }, | ||
| }, | ||
| { | ||
| id: 'id-5', | ||
| displayName: 'Server 5', | ||
| serialNumber: '3123i4264', | ||
| model: 'Proliant SY 660 Gen10', | ||
| powerState: 'On', | ||
| health: { summary: 'OK' }, | ||
| state: { connected: true }, | ||
| }, | ||
| { | ||
| id: 'id-6', | ||
| displayName: '3M442501WV', | ||
| serialNumber: '4208964', | ||
| model: 'ProLiant DL380 Gen10', | ||
| powerState: 'Off', | ||
| health: { summary: 'Critical' }, | ||
| state: { connected: true }, | ||
| }, | ||
| { | ||
| id: 'id-7', | ||
| displayName: 'ZFD3712GP', | ||
| serialNumber: 'CCD21712GP', | ||
| model: null, | ||
| powerState: 'On', | ||
| health: { summary: 'OK' }, | ||
| state: { connected: false }, | ||
| }, | ||
| ]; | ||
|
|
||
| export const PageTwoContent = () => { | ||
| const [selected, setSelected] = useState([]); | ||
|
|
||
| return ( | ||
| <Box> | ||
|
||
| <DataTable | ||
| data={data} | ||
| aria-describedby="Server data table" | ||
| select={selected} | ||
| onSelect={setSelected} | ||
| columns={[ | ||
| { | ||
| property: 'displayName', | ||
| header: 'Name', | ||
| primary: true, | ||
| render: datum => <Text>{datum.displayName}</Text>, | ||
| }, | ||
| { | ||
| property: 'serialNumber', | ||
| header: 'Serial Number', | ||
| }, | ||
| { | ||
| property: 'model', | ||
| header: 'Model', | ||
| render: datum => <Text>{datum.model || '—'}</Text>, | ||
| }, | ||
| { | ||
| property: 'powerState', | ||
| header: 'Power', | ||
| }, | ||
| { | ||
| property: 'health', | ||
| header: 'Health', | ||
| render: datum => <Text>{datum.health?.summary}</Text>, | ||
| }, | ||
| ]} | ||
| /> | ||
| </Box> | ||
| ); | ||
| }; | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I dont think we need those
boxes