@ttoss/layouts 0.3.17 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +26 -6
- package/dist/esm/index.js +2474 -38
- package/dist/index.d.ts +12 -21
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -10,30 +10,50 @@ pnpm add @ttoss/layouts @ttoss/ui @emotion/react
|
|
|
10
10
|
|
|
11
11
|
## Quickstart
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
Use a layout as `StackedLayout` to add specific layout to your application:
|
|
14
14
|
|
|
15
15
|
```tsx
|
|
16
|
-
import { Layout } from '@ttoss/layouts';
|
|
16
|
+
import { Layout, StackedLayout } from '@ttoss/layouts';
|
|
17
17
|
|
|
18
18
|
const App = () => (
|
|
19
|
-
<
|
|
19
|
+
<StackedLayout>
|
|
20
20
|
<Layout.Header>Header</Layout.Header>
|
|
21
21
|
<Layout.Main>Main</Layout.Main>
|
|
22
22
|
<Layout.Footer>Footer</Layout.Footer>
|
|
23
|
-
</
|
|
23
|
+
</StackedLayout>
|
|
24
24
|
);
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
## Layouts
|
|
28
|
+
|
|
29
|
+
Check the [Layouts Stories](http://localhost:6006/?path=/story/layouts-layout) to see the available layouts.
|
|
30
|
+
|
|
31
|
+
## Custom Layout Components
|
|
32
|
+
|
|
33
|
+
You can create your own layout components by using the `Layout` sub-components:
|
|
28
34
|
|
|
29
35
|
```tsx
|
|
30
36
|
import { Layout, StackedLayout } from '@ttoss/layouts';
|
|
31
37
|
|
|
38
|
+
const CustomHeader = (props) => (
|
|
39
|
+
<Layout.Header {...props} style={{ backgroundColor: 'red' }}>
|
|
40
|
+
Header
|
|
41
|
+
</Layout.Header>
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
CustomHeader.displayName = Layout.Header.displayName;
|
|
45
|
+
|
|
32
46
|
const App = () => (
|
|
33
47
|
<StackedLayout>
|
|
34
|
-
<
|
|
48
|
+
<CustomHeader />
|
|
35
49
|
<Layout.Main>Main</Layout.Main>
|
|
36
50
|
<Layout.Footer>Footer</Layout.Footer>
|
|
37
51
|
</StackedLayout>
|
|
38
52
|
);
|
|
39
53
|
```
|
|
54
|
+
|
|
55
|
+
For the layout to work correctly, you must use the `displayName` property of the `Layout` sub-components, because the layout components use the `displayName` to identify the layout sub-components.
|
|
56
|
+
|
|
57
|
+
## License
|
|
58
|
+
|
|
59
|
+
[MIT](https://github.com/ttoss/ttoss/blob/main/LICENSE)
|