@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 CHANGED
@@ -10,30 +10,50 @@ pnpm add @ttoss/layouts @ttoss/ui @emotion/react
10
10
 
11
11
  ## Quickstart
12
12
 
13
- You can use the `Layout` component to add a layout to your application:
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
- <Layout>
19
+ <StackedLayout>
20
20
  <Layout.Header>Header</Layout.Header>
21
21
  <Layout.Main>Main</Layout.Main>
22
22
  <Layout.Footer>Footer</Layout.Footer>
23
- </Layout>
23
+ </StackedLayout>
24
24
  );
25
25
  ```
26
26
 
27
- Or you can use specifics components as `StackedLayout` to add specific layout to your application:
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
- <Layout.Header>Header</Layout.Header>
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)