Skip to content

Commit 4f88905

Browse files
adding ribbon and fix components display name
1 parent 6f23387 commit 4f88905

File tree

6 files changed

+73
-47
lines changed

6 files changed

+73
-47
lines changed

example/stories/Readme.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

example/stories/minimal-usage/minimal-usage.jsx

Lines changed: 0 additions & 1 deletion
This file was deleted.

example/stories/responsive/README.md

Lines changed: 6 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -6,33 +6,11 @@ import useDynTabs from 'react-dyn-tabs';
66
import MoreButtonPlugin from 'react-dyn-tabs/plugins/moreButtonPlugin';
77

88
const initialOptions = {
9-
tabs: [
10-
{
11-
id: '1',
12-
title: 'tab 1',
13-
panelComponent: (porps) => <p> panel 1 </p>,
14-
},
15-
{
16-
id: '2',
17-
title: 'tab 2',
18-
panelComponent: (porps) => <p> panel 2 </p>,
19-
},
20-
{
21-
id: '3',
22-
title: 'tab 3',
23-
panelComponent: (porps) => <p> panel 3 </p>,
24-
},
25-
{
26-
id: '4',
27-
title: 'tab 4',
28-
panelComponent: (porps) => <p> panel 4 </p>,
29-
},
30-
{
31-
id: '5',
32-
title: 'tab 5',
33-
panelComponent: (porps) => <p> panel 5 </p>,
34-
},
35-
],
9+
tabs: Array.from({length: 20}).map((value, i) => ({
10+
id: `${i + 1}`,
11+
title: `tab ${i + 1}`,
12+
panelComponent: <p> {`panel ${i + 1}`} </p>,
13+
})),
3614
selectedTabID: '2',
3715
};
3816

@@ -45,18 +23,5 @@ function App() {
4523
</div>
4624
);
4725
}
48-
function App2() {
49-
const [TabList, PanelList] = useDynTabs(initialOptions);
50-
return (
51-
<div>
52-
<TabList></TabList>
53-
<PanelList></PanelList>
54-
</div>
55-
);
56-
}
57-
58-
<>
59-
<App />
60-
<App2 />
61-
</>;
26+
<App />;
6227
```

example/stories/responsive/responsive.jsx

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
```tsx
2+
import React from 'react';
3+
import 'react-dyn-tabs/style/react-dyn-tabs.css';
4+
import 'react-dyn-tabs/themes/react-dyn-tabs-card.css';
5+
import useDynTabs from 'react-dyn-tabs';
6+
7+
const initialOptions = {
8+
tabs: [
9+
{
10+
id: '1',
11+
title: 'tab1',
12+
panelComponent: (porps) => <p> panel 1 </p>,
13+
},
14+
{
15+
id: '2',
16+
title: 'tab2',
17+
panelComponent: (porps) => <p> panel 2 </p>,
18+
},
19+
],
20+
selectedTabID: '1',
21+
};
22+
23+
function App() {
24+
const [TabList, PanelList, ready] = useDynTabs(initialOptions);
25+
const addTab3 = function () {
26+
ready((instance) => {
27+
// open tab 3
28+
instance.open({id: '3', title: 'Tab 3', panelComponent: (porps) => <p> panel 3 </p>}).then(() => {
29+
console.log('tab 3 is open');
30+
});
31+
// switch to tab 3
32+
instance.select('3').then(() => {
33+
console.log('tab 3 is selected');
34+
});
35+
});
36+
};
37+
38+
return (
39+
<div>
40+
<button onClick={addTab3}>Add tab 3</button>
41+
<TabList></TabList>
42+
<PanelList></PanelList>
43+
</div>
44+
);
45+
}
46+
<App />;
47+
```

styleguide.config.js

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,37 @@ const {version} = require('./package');
33
const path = require('path');
44

55
module.exports = {
6-
title: 'React Dyn Tabs',
6+
title: 'react-dyn-tabs',
77
getComponentPathLine(componentPath) {
88
return ``;
99
},
1010
components: 'example/stories/**/*.{jsx,js,tsx}',
1111
moduleAliases: {
1212
'react-dyn-tabs': path.resolve(__dirname, './'),
1313
},
14+
ribbon: {
15+
// Link to open on the ribbon click (required)
16+
url: 'https://github.com/dev-javascript/react-dyn-tabs',
17+
// Text to show on the ribbon (optional)
18+
text: 'Fork me on GitHub',
19+
},
1420
// assetsDir: "example/stories/assets",
1521
sections: [
1622
{
17-
name: 'Examples',
23+
name: 'Minimal Usage',
1824
content: 'example/stories/minimal-usage/README.md',
19-
components: 'example/stories/**/*.jsx',
25+
sectionDepth: 1,
26+
},
27+
{
28+
name: 'Simple Manipulation',
29+
content: 'example/stories/simple-manipulation/README.md',
30+
//components: 'example/stories/**/*.jsx',
31+
sectionDepth: 1,
32+
},
33+
{
34+
name: 'Responsive',
35+
content: 'example/stories/responsive/README.md',
36+
//components: 'example/stories/**/*.jsx',
2037
sectionDepth: 1,
2138
},
2239
],

0 commit comments

Comments
 (0)