Skip to content

Commit b309751

Browse files
committed
chore: extend demo to include all variants via tabs
1 parent e8b1154 commit b309751

File tree

1 file changed

+56
-26
lines changed

1 file changed

+56
-26
lines changed

src/App.tsx

+56-26
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
import * as React from 'react';
2+
import { Box, Tab, TabList, TabPanel, Tabs } from '@mui/joy';
23
import {
34
ChangelogContainer,
45
ChangelogList,
56
useChangelogs,
7+
ChangelogListBase,
8+
groupChangelogsByComponents,
9+
GroupBy,
610
} from '../dist/updatehive-react';
711

812
export const App: React.FC = () => {
@@ -25,35 +29,61 @@ export const App: React.FC = () => {
2529
}
2630

2731
return (
28-
<div>
32+
<Box>
2933
<h1>UpdateHive - React Client Component</h1>
30-
<h3>Example using UpdateHive react hook</h3>
31-
<div>
32-
{loading || error || data === undefined ? (
33-
<div>Loading changelogs ...</div>
34-
) : (
34+
<h3>Examples using UpdateHive react components</h3>
35+
<Tabs>
36+
<TabList>
37+
<Tab>Hook</Tab>
38+
<Tab>Minimal</Tab>
39+
<Tab>ChangelogList</Tab>
40+
<Tab>Base</Tab>
41+
</TabList>
42+
<TabPanel value={0}>
43+
<h3>Example using UpdateHive react hook</h3>
3544
<div>
36-
<div className="hook table" key={'header'}>
37-
<div className="hook div">Version</div>
38-
<div className="hook div">Description</div>
39-
</div>
40-
{data.map((changelog, index) => (
41-
<div className="hook table" key={`changelog-${index}`}>
42-
<div className="hook div">{changelog.version}</div>
43-
<div className="hook div">{changelog.description}</div>
45+
{loading || error || data === undefined ? (
46+
<div>Loading changelogs ...</div>
47+
) : (
48+
<div>
49+
<div className="hook table" key={'header'}>
50+
<div className="hook div">Version</div>
51+
<div className="hook div">Description</div>
52+
</div>
53+
{data.map((changelog, index) => (
54+
<div className="hook table" key={`changelog-${index}`}>
55+
<div className="hook div">{changelog.version}</div>
56+
<div className="hook div">{changelog.description}</div>
57+
</div>
58+
))}
4459
</div>
45-
))}
60+
)}
4661
</div>
47-
)}
48-
</div>
49-
<h3>Example using UpdateHive react components</h3>
50-
<ChangelogContainer
51-
API_KEY={API_KEY}
52-
product={PRODUCT}
53-
config={{ url: serviceURL }}
54-
>
55-
<ChangelogList />
56-
</ChangelogContainer>
57-
</div>
62+
</TabPanel>
63+
<TabPanel value={1}>
64+
<ChangelogContainer
65+
API_KEY={API_KEY}
66+
product={PRODUCT}
67+
config={{ url: serviceURL }}
68+
>
69+
<ChangelogList groupBy={GroupBy.NONE} hideEntryType />
70+
</ChangelogContainer>
71+
</TabPanel>
72+
<TabPanel value={2}>
73+
<ChangelogContainer
74+
API_KEY={API_KEY}
75+
product={PRODUCT}
76+
config={{ url: serviceURL }}
77+
>
78+
<ChangelogList />
79+
</ChangelogContainer>
80+
</TabPanel>
81+
<TabPanel value={3}>
82+
<ChangelogListBase
83+
changelogs={data && groupChangelogsByComponents(data)}
84+
/>
85+
</TabPanel>
86+
</Tabs>
87+
</Box>
5888
);
5989
};

0 commit comments

Comments
 (0)