|
| 1 | +import { Grid, Layout, useTheme } from '@/packages'; |
| 2 | +import Playground from '@/src/app/components/playground'; |
| 3 | +import { headerStyle, contentStyle, sidebarStyle, footerStyle } from '@/demo/layout' |
| 4 | + |
| 5 | +# Layout |
| 6 | + |
| 7 | +Used to divide the overall layout of the page. |
| 8 | + |
| 9 | +## Import |
| 10 | + |
| 11 | +```tsx |
| 12 | +import { Layout } from 'raw-ui'; |
| 13 | +``` |
| 14 | + |
| 15 | +## Basic |
| 16 | + |
| 17 | +<Playground |
| 18 | + scope={{ Grid, Layout, useTheme, headerStyle, contentStyle, sidebarStyle, footerStyle }} |
| 19 | + code={` |
| 20 | +() => { |
| 21 | + const theme = useTheme(); |
| 22 | +
|
| 23 | + return ( |
| 24 | + <Grid gutter={[16, 16]}> |
| 25 | + <Grid.Col span={12}> |
| 26 | + <Layout> |
| 27 | + <Layout.Header style={headerStyle(theme)}>Header</Layout.Header> |
| 28 | + <Layout.Content style={contentStyle(theme)}>Content</Layout.Content> |
| 29 | + <Layout.Footer style={footerStyle(theme)}>Footer</Layout.Footer> |
| 30 | + </Layout> |
| 31 | + </Grid.Col> |
| 32 | + <Grid.Col span={12}> |
| 33 | + <Layout> |
| 34 | + <Layout.Header style={headerStyle(theme)}>Header</Layout.Header> |
| 35 | + <Layout> |
| 36 | + <Layout.Sidebar style={sidebarStyle(theme)}>Sidebar</Layout.Sidebar> |
| 37 | + <Layout.Content style={contentStyle(theme)}>Content</Layout.Content> |
| 38 | + </Layout> |
| 39 | + <Layout.Footer style={footerStyle(theme)}>Footer</Layout.Footer> |
| 40 | + </Layout> |
| 41 | + </Grid.Col> |
| 42 | + <Grid.Col span={12}> |
| 43 | + <Layout> |
| 44 | + <Layout.Header style={headerStyle(theme)}>Header</Layout.Header> |
| 45 | + <Layout> |
| 46 | + <Layout.Content style={contentStyle(theme)}>Content</Layout.Content> |
| 47 | + <Layout.Sidebar style={sidebarStyle(theme)}>Sidebar</Layout.Sidebar> |
| 48 | + </Layout> |
| 49 | + <Layout.Footer style={footerStyle(theme)}>Footer</Layout.Footer> |
| 50 | + </Layout> |
| 51 | + </Grid.Col> |
| 52 | + <Grid.Col span={12}> |
| 53 | + <Layout> |
| 54 | + <Layout.Sidebar style={sidebarStyle(theme)}>Sidebar</Layout.Sidebar> |
| 55 | + <Layout> |
| 56 | + <Layout.Header style={headerStyle(theme)}>Header</Layout.Header> |
| 57 | + <Layout.Content style={contentStyle(theme)}>Content</Layout.Content> |
| 58 | + <Layout.Footer style={footerStyle(theme)}>Footer</Layout.Footer> |
| 59 | + </Layout> |
| 60 | + </Layout> |
| 61 | + </Grid.Col> |
| 62 | + </Grid> |
| 63 | + ); |
| 64 | +} |
| 65 | +`} |
| 66 | +/> |
| 67 | + |
| 68 | +## API |
| 69 | + |
| 70 | +### Layout |
| 71 | + |
| 72 | +| Prop | Description | Type | Default | |
| 73 | +| ------------ | ---------------------- | -------------------------- | -------- | |
| 74 | +| ... | native props | React.HTMLAttributes | - | |
| 75 | + |
| 76 | +### Layout.Header |
| 77 | + |
| 78 | +| Prop | Description | Type | Default | |
| 79 | +| ------------ | ---------------------- | -------------------------- | -------- | |
| 80 | +| ... | native props | React.HTMLAttributes | - | |
| 81 | + |
| 82 | +### Layout.Sidebar |
| 83 | + |
| 84 | +| Prop | Description | Type | Default | |
| 85 | +| ------------ | ---------------------- | -------------------------- | -------- | |
| 86 | +| ... | native props | React.HTMLAttributes | - | |
| 87 | + |
| 88 | +### Layout.Content |
| 89 | + |
| 90 | +| Prop | Description | Type | Default | |
| 91 | +| ------------ | ---------------------- | -------------------------- | -------- | |
| 92 | +| ... | native props | React.HTMLAttributes | - | |
| 93 | + |
| 94 | +### Layout.Footer |
| 95 | + |
| 96 | +| Prop | Description | Type | Default | |
| 97 | +| ------------ | ---------------------- | -------------------------- | -------- | |
| 98 | +| ... | native props | React.HTMLAttributes | - | |
| 99 | + |
0 commit comments