-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathSidebar.tsx
More file actions
50 lines (45 loc) · 1.23 KB
/
Sidebar.tsx
File metadata and controls
50 lines (45 loc) · 1.23 KB
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
import React from 'react';
import { Layout } from '@tiny-design/react';
export default function SidebarDemo() {
const { Sidebar, Header, Content } = Layout;
const [collapsed, setCollapsed] = React.useState(false);
const sidebarStyle = {
background: 'color-mix(in srgb, var(--ty-color-primary) 84%, transparent)',
color: '#fff',
textAlign: 'center',
};
const headerStyle = {
background: 'color-mix(in srgb, var(--ty-color-primary) 70%, transparent)',
color: '#fff',
height: '64px',
lineHeight: '64px',
textAlign: 'center',
};
const contentStyle = {
background: 'color-mix(in srgb, var(--ty-color-primary) 98%, transparent)',
color: '#fff',
minHeight: '200px',
lineHeight: '200px',
textAlign: 'center',
};
return (
<Layout>
<Sidebar
style={sidebarStyle}
collapsible
collapsed={collapsed}
onCollapse={setCollapsed}
width={200}
collapsedWidth={60}
>
<div style={{ padding: '16px 0' }}>
{collapsed ? '☰' : 'Sidebar'}
</div>
</Sidebar>
<Layout>
<Header style={headerStyle}>Header</Header>
<Content style={contentStyle}>Content</Content>
</Layout>
</Layout>
);
}