/
SimpleTwoPageTab.tsx
78 lines (72 loc) · 1.83 KB
/
SimpleTwoPageTab.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import React, { FC } from "react";
import {
AppBar,
AppBarAction,
AppBarNav,
AppBarTitle,
} from "@react-md/app-bar";
import {
FavoriteSVGIcon,
MenuSVGIcon,
MoreVertSVGIcon,
TimerSVGIcon,
} from "@react-md/material-icons";
import { MediaContainer } from "@react-md/media";
import {
TabConfig,
TabPanel,
TabPanels,
Tabs,
TabsManager,
} from "@react-md/tabs";
import { GridList, useAppSize } from "@react-md/utils";
const tabs: TabConfig[] = [
{ icon: <TimerSVGIcon />, children: "Recent" },
{ icon: <FavoriteSVGIcon />, children: "Favorites" },
];
const Header: FC = () => {
const { isTablet } = useAppSize();
return (
<AppBar theme="default" height="none">
<AppBar>
<AppBarNav aria-label="Menu">
<MenuSVGIcon />
</AppBarNav>
<AppBarTitle>My pictures</AppBarTitle>
<AppBarAction first last aria-label="Options">
<MoreVertSVGIcon />
</AppBarAction>
</AppBar>
<Tabs align={isTablet ? "center" : "left"} />
</AppBar>
);
};
const Panels: FC = () => (
<TabPanels>
<TabPanel>
<GridList maxCellSize={200} clone>
{Array.from({ length: 10 }, (_, i) => (
<MediaContainer key={i}>
<img src={`https://picsum.photos/200?image=${i + 1}`} alt="" />
</MediaContainer>
))}
</GridList>
</TabPanel>
<TabPanel>
<GridList maxCellSize={200} clone>
{Array.from({ length: 22 }, (_, i) => (
<MediaContainer key={i}>
<img src={`https://picsum.photos/200?image=${i + 51}`} alt="" />
</MediaContainer>
))}
</GridList>
</TabPanel>
</TabPanels>
);
const SimpleTwoPageTab: FC = () => (
<TabsManager stacked tabs={tabs} tabsId="simple-two-page-tabs">
<Header />
<Panels />
</TabsManager>
);
export default SimpleTwoPageTab;