-
Notifications
You must be signed in to change notification settings - Fork 266
WS-2187 - Create Storybook Component for New Navigation #13736
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
base: latest
Are you sure you want to change the base?
Changes from all commits
e25838a
c9a639a
af56a2c
c58d015
5cf2394
3c05b15
f315854
6fe30ba
7e0db89
4dcc57f
81baabf
8146dfc
4d15764
70c33fe
ed3aa69
76e1b00
8089657
940fe11
0cf920e
2d7c52c
6f3f573
e3442d7
2aa957a
7f35f4d
49b5903
869c815
79b7339
32f6ebb
a7a650d
2da61b9
7407d04
4890417
792987d
a2d4592
af6e074
c9346d7
4ea5bc4
315db7d
8e659d8
7583abc
7f9726c
e137d05
401197d
5df4af2
63b49b2
dcf5358
6613489
2d51bcb
798f7aa
0939920
285f44c
73f61a6
0d6e8a1
2d1c0c3
f4d4459
388915e
ab29a82
769551d
d1435d0
85635bc
c85dc7f
1af87be
c820fd6
2520cf0
487531f
05f8bdc
4a5c53e
1c2a206
3cf1339
094d864
6d1d234
e598568
4bfea6e
c7803c2
c5f96e1
5d17386
115d23b
e74b20c
7de4877
3e11779
5a256b6
2476525
298d581
bfacfed
0b3dc6f
8a8bf96
a5a7d3a
7e72ca7
0fc6138
7ec9745
26fc101
8c3cebe
493f67a
06d2969
87bf622
13685be
931ad05
8ad0d07
a63c1da
36c8d04
5faa178
44568dd
845f8e3
8a92d18
560626c
9632c6e
864b5f3
a60ec8c
396b912
51a83b8
29211ad
0e3bff9
1a5d1f5
f2c96ae
feed854
9ffb79f
a3ffb97
1878ad0
779c27e
0aa9168
1745e25
9845895
abbc0c9
f2e9e7b
a4df649
d846640
a22d390
1f8fddb
7add17d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,18 @@ | ||||||
| ## Description | ||||||
|
|
||||||
| This component renders a the navigation bar which comprises of two tiers, the primary being three categories and the secondary being links to topics. | ||||||
|
|
||||||
| ## Props | ||||||
|
|
||||||
| | Name | type | Description | | ||||||
| | ------------------------- | --------------------------- | --------------------------------------------------------- | | ||||||
| | navItems | Navigation[] | Array of Navigation items to display within the component | | ||||||
| | propsForTopBarOJComponent | { blocks?: TopStoryItem[] } | Optional object with blocks to display TopStoryItem | | ||||||
|
||||||
|
|
||||||
| ## How to use | ||||||
|
|
||||||
| Import and use the component in your page or story: | ||||||
|
|
||||||
| ```tsx | ||||||
| import Navigation from './Navigation'; | ||||||
holchris marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
| import Navigation from './Navigation'; | |
| import Navigation from '.'; |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,8 +1,68 @@ | ||||||||||||||||||||||||||||
| const Component = () => <div>Navigation</div>; | ||||||||||||||||||||||||||||
| import Navigation from '.'; | ||||||||||||||||||||||||||||
| import { ServiceContextProvider } from '#app/contexts/ServiceContext'; | ||||||||||||||||||||||||||||
| import type { | ||||||||||||||||||||||||||||
| Navigation as NavigationType, | ||||||||||||||||||||||||||||
| Services, | ||||||||||||||||||||||||||||
| } from '#app/models/types/global'; | ||||||||||||||||||||||||||||
| import readme from './README.md'; | ||||||||||||||||||||||||||||
| import metadata from './metadata.json'; | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| interface Props { | ||||||||||||||||||||||||||||
| navItems: NavigationType[]; | ||||||||||||||||||||||||||||
| service: Services; | ||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| const Component = ({ navItems, service }: Props) => { | ||||||||||||||||||||||||||||
| return ( | ||||||||||||||||||||||||||||
| <ServiceContextProvider service={service}> | ||||||||||||||||||||||||||||
| <Navigation navItems={navItems} /> | ||||||||||||||||||||||||||||
| </ServiceContextProvider> | ||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||
|
Comment on lines
+15
to
+20
|
||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| export default { | ||||||||||||||||||||||||||||
| title: 'Components/NewNavigation', | ||||||||||||||||||||||||||||
| title: 'Components/Navigation', | ||||||||||||||||||||||||||||
| Component, | ||||||||||||||||||||||||||||
| parameters: { | ||||||||||||||||||||||||||||
| docs: { readme }, | ||||||||||||||||||||||||||||
| metadata, | ||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| export const Example = Component; | ||||||||||||||||||||||||||||
| export const Arabic = () => { | ||||||||||||||||||||||||||||
| const navItems = [ | ||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||
| title: 'رئيسية', | ||||||||||||||||||||||||||||
| url: '/home', | ||||||||||||||||||||||||||||
| subItems: [ | ||||||||||||||||||||||||||||
| { title: 'أخبار', url: '/home/section1' }, | ||||||||||||||||||||||||||||
| { title: 'شاهد', url: '/home/section2' }, | ||||||||||||||||||||||||||||
| { title: 'صحة وعلوم', url: '/home/section3' }, | ||||||||||||||||||||||||||||
| ], | ||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||
| title: 'شاهد', | ||||||||||||||||||||||||||||
| url: '/news', | ||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||
| ]; | ||||||||||||||||||||||||||||
| return <Component navItems={navItems} service={'arabic'} />; | ||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| export const Pidgin = () => { | ||||||||||||||||||||||||||||
| const navItems = [ | ||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||
| title: 'News', | ||||||||||||||||||||||||||||
| url: '/home', | ||||||||||||||||||||||||||||
| subItems: [ | ||||||||||||||||||||||||||||
| { title: 'Nigeria', url: '/home/section1' }, | ||||||||||||||||||||||||||||
| { title: 'Africa', url: '/home/section2' }, | ||||||||||||||||||||||||||||
| { title: 'World', url: '/home/section3' }, | ||||||||||||||||||||||||||||
| ], | ||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||
| title: 'Video', | ||||||||||||||||||||||||||||
| url: '/news', | ||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||
| ]; | ||||||||||||||||||||||||||||
| return <Component navItems={navItems} service={'pidgin'} />; | ||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
| }; | |
| }; | |
| Pidgin.storyName = 'Pidgin (demo only)'; | |
| Pidgin.parameters = { | |
| docs: { | |
| description: { | |
| story: | |
| 'This story is for demonstration purposes only. The Pidgin service is not currently configured in SERVICES_WITH_NEW_NAV, so this story does not reflect the production navigation configuration.', | |
| }, | |
| }, | |
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| { | ||
| "alpha": false, | ||
| "lastUpdated": { | ||
| "day": 24, | ||
| "month": "February", | ||
| "year": 2026 | ||
| }, | ||
| "uxAccessibilityDoc": { | ||
| "done": false, | ||
| "reference": { | ||
| "url": "", | ||
| "label": "Screen Reader UX" | ||
| } | ||
| }, | ||
| "acceptanceCriteria": { | ||
| "done": false, | ||
| "reference": { | ||
| "url": "", | ||
| "label": "Accessibility Acceptance Criteria" | ||
| } | ||
| }, | ||
| "swarm": { | ||
| "done": false, | ||
| "reference": { | ||
| "url": "", | ||
| "label": "Accessibility Swarm Notes" | ||
| } | ||
| } | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.