1
- import { Canvas , Story , ArgsTable , Meta , Source } from ' @storybook/blocks' ;
2
- import { TabBar } from ' ../TabBar' ;
3
- import { TabBarExample } from ' ./TabBarExample' ;
1
+ import { Primary , ArgTypes , Meta } from ' @storybook/blocks' ;
2
+
4
3
import { StyledSystemLinks } from ' ../../../docs/StyledSystemLinks' ;
4
+ import * as TabBarStories from ' ./TabBar.stories' ;
5
+
6
+ <Meta of = { TabBarStories } />
5
7
6
- <Meta
7
- title = " Components/TabBar"
8
- component = { TabBar }
9
- argTypes = { {
10
- initiallySelected: {
11
- control: ' radio' ,
12
- options: [' A New Hope' , ' Empire Strikes Back' , ' Return of the Jedi' ]
13
- }
14
- }}
15
- />
16
-
17
- # Tabbar
18
-
19
- <Canvas >
20
- <Story name = " Default" args = { {}} >
21
- { TabBarExample .bind ({})}
22
- </Story >
23
- </Canvas >
8
+ # TabBar
9
+
10
+ <Primary />
24
11
25
12
- This component is a sub-navigation to organize different categories of a content on the same page
26
13
- The recommended amount of tabs is 2-5
@@ -31,23 +18,20 @@ import { StyledSystemLinks } from '../../../docs/StyledSystemLinks';
31
18
32
19
### TabBar.Link
33
20
34
- <ArgsTable of = { TabBar .Link } />
21
+ <ArgTypes of = { TabBarStories } />
22
+
35
23
<StyledSystemLinks component = " TabBar" supportedProps = { [' margin' ]} />
36
24
37
25
The ` TabBar.Link ` supports all the props that can be passed to ` <a> ` tag.
38
26
39
- ### Usage with react-router
27
+ ## Usage
40
28
41
- When using this component as a navigational element with the ` NavLink ` from react-router, the class name ` active ` on the
42
- ` TabBar.Link ` element can also be used to indicate that the element is active and is the default that react-router adds
43
- to active ` NavLink ` elements.
29
+ ### Idiomatic usage
44
30
45
- ## Idiomatic usage
46
-
47
- ``` jsx
31
+ ``` tsx
48
32
const TabBarExample = () => {
49
33
const items = [' A New Hope' , ' Empire Strikes Back' , ' Return of the Jedi' ];
50
- const [selected , setSelected ] = useState (items[0 ]);
34
+ const [selected, setSelected] = useState < string > (items [0 ]);
51
35
52
36
return (
53
37
<TabBar my = { 5 } >
@@ -60,3 +44,9 @@ const TabBarExample = () => {
60
44
);
61
45
};
62
46
```
47
+
48
+ ### With react-router
49
+
50
+ When using this component as a navigational element with the ` NavLink ` from react-router, the class name ` active ` on the
51
+ ` TabBar.Link ` element can also be used to indicate that the element is active and is the default that react-router adds
52
+ to active ` NavLink ` elements.
0 commit comments