|
| 1 | +import { Grid, Layout, RawUITheme, useTheme } from '@/packages'; |
| 2 | +import { CSSProperties } from 'react'; |
| 3 | + |
| 4 | +const headerStyle = (theme: RawUITheme): CSSProperties => ({ |
| 5 | + display: 'flex', |
| 6 | + alignItems: 'center', |
| 7 | + justifyContent: 'center', |
| 8 | + height: '64px', |
| 9 | + color: theme.palette.accents6, |
| 10 | + backgroundColor: theme.palette.accents4, |
| 11 | +}); |
| 12 | + |
| 13 | +const contentStyle = (theme: RawUITheme): CSSProperties => ({ |
| 14 | + display: 'flex', |
| 15 | + alignItems: 'center', |
| 16 | + justifyContent: 'center', |
| 17 | + minHeight: '120px', |
| 18 | + color: theme.palette.accents4, |
| 19 | + backgroundColor: theme.palette.accents6, |
| 20 | +}); |
| 21 | + |
| 22 | +const sidebarStyle = (theme: RawUITheme): CSSProperties => ({ |
| 23 | + display: 'flex', |
| 24 | + alignItems: 'center', |
| 25 | + justifyContent: 'center', |
| 26 | + width: '25%', |
| 27 | + color: theme.palette.accents3, |
| 28 | + backgroundColor: theme.palette.accents5, |
| 29 | +}); |
| 30 | + |
| 31 | +const footerStyle = (theme: RawUITheme): CSSProperties => ({ |
| 32 | + display: 'flex', |
| 33 | + alignItems: 'center', |
| 34 | + justifyContent: 'center', |
| 35 | + height: '64px', |
| 36 | + color: theme.palette.accents6, |
| 37 | + backgroundColor: theme.palette.accents4, |
| 38 | +}); |
| 39 | + |
| 40 | +export function DemoLayoutBasic() { |
| 41 | + const theme = useTheme(); |
| 42 | + |
| 43 | + return ( |
| 44 | + <Grid gutter={[16, 16]}> |
| 45 | + <Grid.Col span={12}> |
| 46 | + <Layout> |
| 47 | + <Layout.Header style={headerStyle(theme)}>Header</Layout.Header> |
| 48 | + <Layout.Content style={contentStyle(theme)}>Content</Layout.Content> |
| 49 | + <Layout.Footer style={footerStyle(theme)}>Footer</Layout.Footer> |
| 50 | + </Layout> |
| 51 | + </Grid.Col> |
| 52 | + <Grid.Col span={12}> |
| 53 | + <Layout> |
| 54 | + <Layout.Header style={headerStyle(theme)}>Header</Layout.Header> |
| 55 | + <Layout> |
| 56 | + <Layout.Sidebar style={sidebarStyle(theme)}>Sidebar</Layout.Sidebar> |
| 57 | + <Layout.Content style={contentStyle(theme)}>Content</Layout.Content> |
| 58 | + </Layout> |
| 59 | + <Layout.Footer style={footerStyle(theme)}>Footer</Layout.Footer> |
| 60 | + </Layout> |
| 61 | + </Grid.Col> |
| 62 | + <Grid.Col span={12}> |
| 63 | + <Layout> |
| 64 | + <Layout.Header style={headerStyle(theme)}>Header</Layout.Header> |
| 65 | + <Layout> |
| 66 | + <Layout.Content style={contentStyle(theme)}>Content</Layout.Content> |
| 67 | + <Layout.Sidebar style={sidebarStyle(theme)}>Sidebar</Layout.Sidebar> |
| 68 | + </Layout> |
| 69 | + <Layout.Footer style={footerStyle(theme)}>Footer</Layout.Footer> |
| 70 | + </Layout> |
| 71 | + </Grid.Col> |
| 72 | + <Grid.Col span={12}> |
| 73 | + <Layout> |
| 74 | + <Layout.Sidebar style={sidebarStyle(theme)}>Sidebar</Layout.Sidebar> |
| 75 | + <Layout> |
| 76 | + <Layout.Header style={headerStyle(theme)}>Header</Layout.Header> |
| 77 | + <Layout.Content style={contentStyle(theme)}>Content</Layout.Content> |
| 78 | + <Layout.Footer style={footerStyle(theme)}>Footer</Layout.Footer> |
| 79 | + </Layout> |
| 80 | + </Layout> |
| 81 | + </Grid.Col> |
| 82 | + </Grid> |
| 83 | + ); |
| 84 | +} |
0 commit comments