@inc2734/unitone-css 0.46.5 → 0.47.2
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/dist/app.css +1 -1
- package/dist/app.js +1 -1
- package/dist/index.js +1 -0
- package/dist/library.js +1 -0
- package/dist/storybook.css +1 -1
- package/package.json +27 -17
- package/src/app.js +5 -132
- package/src/foundation/_foundation.scss +7 -1
- package/src/index.js +1 -0
- package/src/layout-primitives/both-sides/README.md +96 -7
- package/src/layout-primitives/both-sides/stories/index.stories.jsx +2 -5
- package/src/layout-primitives/center/README.md +85 -21
- package/src/layout-primitives/center/stories/index.stories.jsx +2 -2
- package/src/layout-primitives/cluster/README.md +87 -4
- package/src/layout-primitives/cluster/stories/index.stories.jsx +1 -1
- package/src/layout-primitives/container/README.md +73 -19
- package/src/layout-primitives/container/stories/index.stories.jsx +2 -2
- package/src/layout-primitives/cover/README.md +144 -18
- package/src/layout-primitives/cover/_cover.scss +24 -24
- package/src/layout-primitives/cover/index.jsx +63 -0
- package/src/layout-primitives/cover/stories/index.stories.jsx +20 -19
- package/src/layout-primitives/decorator/README.md +134 -12
- package/src/layout-primitives/decorator/stories/index.stories.jsx +2 -2
- package/src/layout-primitives/float/README.md +93 -2
- package/src/layout-primitives/float/stories/index.stories.jsx +3 -3
- package/src/layout-primitives/frame/README.md +53 -1
- package/src/layout-primitives/frame/stories/index.stories.jsx +1 -1
- package/src/layout-primitives/gutters/README.md +35 -11
- package/src/layout-primitives/gutters/stories/index.stories.jsx +4 -4
- package/src/layout-primitives/index.js +17 -0
- package/src/layout-primitives/layers/README.md +240 -4
- package/src/layout-primitives/layers/{Layers.jsx → index.jsx} +16 -1
- package/src/layout-primitives/layers/stories/index.stories.jsx +32 -2
- package/src/layout-primitives/reel/README.md +81 -28
- package/src/layout-primitives/reel/stories/index.stories.jsx +3 -3
- package/src/layout-primitives/responsive-grid/README.md +103 -8
- package/src/layout-primitives/responsive-grid/{ResponsiveGrid.jsx → index.jsx} +2 -1
- package/src/layout-primitives/responsive-grid/stories/index.stories.jsx +187 -26
- package/src/layout-primitives/stack/README.md +61 -2
- package/src/layout-primitives/stack/_stack.scss +2 -0
- package/src/layout-primitives/stack/stories/index.stories.jsx +3 -3
- package/src/layout-primitives/switcher/README.md +60 -4
- package/src/layout-primitives/switcher/stories/index.stories.jsx +2 -2
- package/src/layout-primitives/text/README.md +117 -2
- package/src/layout-primitives/text/stories/index.stories.jsx +13 -3
- package/src/layout-primitives/vertical-writing/README.md +96 -3
- package/src/layout-primitives/vertical-writing/stories/index.stories.jsx +2 -2
- package/src/layout-primitives/with-sidebar/README.md +136 -3
- package/src/layout-primitives/with-sidebar/stories/index.stories.jsx +4 -7
- package/src/library.js +132 -0
- package/src/patterns/features/features-1/Features1.jsx +9 -7
- package/src/patterns/features/features-2/Features2.jsx +1 -6
- package/src/patterns/header/header-1/Header1.jsx +10 -7
- package/src/patterns/header/header-2/Header2.jsx +1 -6
- package/src/patterns/header/header-3/Header3.jsx +1 -6
- package/src/patterns/header/header-4/Header4.jsx +9 -6
- package/src/patterns/header/header-5/Header5.jsx +9 -6
- package/src/patterns/header/header-6/Header6.jsx +10 -7
- package/src/patterns/media-text/media-text-1/MediaText1.jsx +9 -6
- package/src/patterns/media-text/media-text-2/MediaText2.jsx +8 -5
- package/src/settings/_root.scss +8 -8
- package/src/stories/1.introduction.stories.mdx +37 -4
- package/src/stories/2.get-started.stories.mdx +28 -2
- package/src/stories/3.global-api.stories.mdx +26 -22
- package/src/stories/4.global-css-variables.stories.mdx +198 -0
- package/src/variables/_variables.scss +2 -0
- package/src/layout-primitives/cover/Cover.jsx +0 -41
- /package/src/layout-primitives/both-sides/{BothSides.jsx → index.jsx} +0 -0
- /package/src/layout-primitives/center/{Center.jsx → index.jsx} +0 -0
- /package/src/layout-primitives/cluster/{Cluster.jsx → index.jsx} +0 -0
- /package/src/layout-primitives/container/{Container.jsx → index.jsx} +0 -0
- /package/src/layout-primitives/decorator/{Decorator.jsx → index.jsx} +0 -0
- /package/src/layout-primitives/float/{Float.jsx → index.jsx} +0 -0
- /package/src/layout-primitives/frame/{Frame.jsx → index.jsx} +0 -0
- /package/src/layout-primitives/gutters/{Gutters.jsx → index.jsx} +0 -0
- /package/src/layout-primitives/reel/{Reel.jsx → index.jsx} +0 -0
- /package/src/layout-primitives/stack/{Stack.jsx → index.jsx} +0 -0
- /package/src/layout-primitives/switcher/{Switcher.jsx → index.jsx} +0 -0
- /package/src/layout-primitives/text/{Text.jsx → index.jsx} +0 -0
- /package/src/layout-primitives/vertical-writing/{VerticalWriting.jsx → index.jsx} +0 -0
- /package/src/layout-primitives/with-sidebar/{WithSidebar.jsx → index.jsx} +0 -0
|
@@ -1,28 +1,34 @@
|
|
|
1
|
+
# Container
|
|
2
|
+
|
|
3
|
+
Keep the content area within a certain width, plus appropriate margins on the left and right.
|
|
4
|
+
|
|
1
5
|
## Usage
|
|
2
6
|
|
|
7
|
+
### HTML
|
|
8
|
+
|
|
3
9
|
```html
|
|
4
10
|
<div data-unitone-layout="container">
|
|
5
|
-
|
|
6
|
-
<h2>Lorem ipsum dolor sit amet, consectetur adipisicing elit</h2>
|
|
7
|
-
<p>
|
|
8
|
-
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt
|
|
9
|
-
ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation
|
|
10
|
-
ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in
|
|
11
|
-
reprehenderit in voluptate velit esse cill
|
|
12
|
-
</p>
|
|
13
|
-
|
|
14
|
-
<h3>Lorem ipsum dolor sit amet, consectetur adipisicing elit</h3>
|
|
15
|
-
<p>
|
|
16
|
-
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt
|
|
17
|
-
ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation
|
|
18
|
-
ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in
|
|
19
|
-
reprehenderit in voluptate velit esse cill
|
|
20
|
-
</p>
|
|
21
|
-
</div>
|
|
11
|
+
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cill
|
|
22
12
|
</div>
|
|
23
13
|
```
|
|
24
14
|
|
|
25
|
-
###
|
|
15
|
+
### JSX
|
|
16
|
+
|
|
17
|
+
```jsx
|
|
18
|
+
import { Container } from '@inc2734/unitone-css';
|
|
19
|
+
|
|
20
|
+
<Container>
|
|
21
|
+
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cill
|
|
22
|
+
</Container>
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Props
|
|
26
|
+
|
|
27
|
+
### Gutters
|
|
28
|
+
|
|
29
|
+
Gutters.
|
|
30
|
+
|
|
31
|
+
#### HTML
|
|
26
32
|
|
|
27
33
|
```html
|
|
28
34
|
<div data-unitone-layout="container -gutters:1">
|
|
@@ -30,10 +36,58 @@
|
|
|
30
36
|
</div>
|
|
31
37
|
```
|
|
32
38
|
|
|
33
|
-
|
|
39
|
+
#### JSX
|
|
40
|
+
|
|
41
|
+
```jsx
|
|
42
|
+
import { Container } from '@inc2734/unitone-css';
|
|
43
|
+
|
|
44
|
+
<Container gutters={1}>
|
|
45
|
+
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cill
|
|
46
|
+
</Container>
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Align
|
|
50
|
+
|
|
51
|
+
Alignment of the container.
|
|
52
|
+
|
|
53
|
+
start / center / end
|
|
54
|
+
|
|
55
|
+
#### HTML
|
|
34
56
|
|
|
35
57
|
```html
|
|
36
58
|
<div data-unitone-layout="container -align:start">
|
|
37
59
|
...
|
|
38
60
|
</div>
|
|
39
61
|
```
|
|
62
|
+
|
|
63
|
+
#### JSX
|
|
64
|
+
|
|
65
|
+
```jsx
|
|
66
|
+
import { Container } from '@inc2734/unitone-css';
|
|
67
|
+
|
|
68
|
+
<Container align="start">
|
|
69
|
+
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cill
|
|
70
|
+
</Container>
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Max width
|
|
74
|
+
|
|
75
|
+
Max width.
|
|
76
|
+
|
|
77
|
+
#### HTML
|
|
78
|
+
|
|
79
|
+
```html
|
|
80
|
+
<div data-unitone-layout="container" style="--unitone--max-width: 1280px">
|
|
81
|
+
...
|
|
82
|
+
</div>
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
#### JSX
|
|
86
|
+
|
|
87
|
+
```jsx
|
|
88
|
+
import { Container } from '@inc2734/unitone-css';
|
|
89
|
+
|
|
90
|
+
<Container maxWidth="1280px">
|
|
91
|
+
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cill
|
|
92
|
+
</Container>
|
|
93
|
+
```
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import readme from '../README.md';
|
|
3
3
|
|
|
4
|
-
import { Container } from '../
|
|
5
|
-
import { Text } from '../../text
|
|
4
|
+
import { Container } from '../';
|
|
5
|
+
import { Text } from '../../text';
|
|
6
6
|
|
|
7
7
|
export default {
|
|
8
8
|
title: 'Layout Primitives/Container',
|
|
@@ -1,10 +1,17 @@
|
|
|
1
|
+
# Cover
|
|
2
|
+
|
|
3
|
+
This component is designed to cover a large area of the screen.
|
|
4
|
+
|
|
1
5
|
## Usage
|
|
2
6
|
|
|
7
|
+
### HTML
|
|
8
|
+
|
|
3
9
|
```html
|
|
4
10
|
<div data-unitone-layout="decorator" style="--unitone--background-color: #000; --unitone--color: #fff; --unitone--padding: 0">
|
|
5
11
|
<div data-unitone-layout="cover">
|
|
6
12
|
<p>Lorem ipsum</p>
|
|
7
|
-
|
|
13
|
+
|
|
14
|
+
<div data-unitone-layout="cover__content -valign:center">
|
|
8
15
|
<div data-unitone-layout="stack">
|
|
9
16
|
<h1 style="--unitone--font-size: 6">Lorem ipsum dolor sit amet</h1>
|
|
10
17
|
<p>
|
|
@@ -13,57 +20,176 @@
|
|
|
13
20
|
</p>
|
|
14
21
|
</div>
|
|
15
22
|
</div>
|
|
23
|
+
|
|
16
24
|
<p>sed do</p>
|
|
17
25
|
</div>
|
|
18
26
|
</div>
|
|
19
27
|
```
|
|
20
28
|
|
|
21
|
-
###
|
|
29
|
+
### JSX
|
|
22
30
|
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
|
|
31
|
+
```jsx
|
|
32
|
+
import { Decorator, Cover, CoverContent, Stack } from '@inc2734/unitone-css';
|
|
33
|
+
|
|
34
|
+
<Decorator backgroundColor="#000" color="#fff" padding={0}>
|
|
35
|
+
<Cover>
|
|
26
36
|
<p>Lorem ipsum</p>
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
37
|
+
|
|
38
|
+
<CoverContent valign="center">
|
|
39
|
+
<Stack>
|
|
40
|
+
<h1 style={{ '--unitone--font-size': 6 }}>Lorem ipsum dolor sit amet</h1>
|
|
30
41
|
<p>
|
|
31
42
|
consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore
|
|
32
43
|
magna aliqua.
|
|
33
44
|
</p>
|
|
34
|
-
</
|
|
35
|
-
</
|
|
36
|
-
|
|
45
|
+
</Stack>
|
|
46
|
+
</CoverContent>
|
|
47
|
+
|
|
48
|
+
<p>sed do</p>
|
|
49
|
+
</Cover>
|
|
50
|
+
</Decorator>
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Props
|
|
54
|
+
|
|
55
|
+
### Gap
|
|
56
|
+
|
|
57
|
+
Gap.
|
|
58
|
+
|
|
59
|
+
Since this is also reflected in the padding, specify 0 for padding if padding is not required.
|
|
60
|
+
|
|
61
|
+
#### HTML
|
|
62
|
+
|
|
63
|
+
```html
|
|
64
|
+
<div data-unitone-layout="cover -gap:1">
|
|
65
|
+
...
|
|
37
66
|
</div>
|
|
38
67
|
```
|
|
39
68
|
|
|
40
|
-
|
|
69
|
+
#### JSX
|
|
70
|
+
|
|
71
|
+
```jsx
|
|
72
|
+
import { Cover } from '@inc2734/unitone-css';
|
|
73
|
+
|
|
74
|
+
<Cover gap={1}>
|
|
75
|
+
...
|
|
76
|
+
</Cover>
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Padding
|
|
80
|
+
|
|
81
|
+
Padding.
|
|
82
|
+
|
|
83
|
+
#### HTML
|
|
41
84
|
|
|
42
85
|
```html
|
|
43
|
-
<div data-unitone-layout="cover -
|
|
86
|
+
<div data-unitone-layout="cover -padding:1">
|
|
44
87
|
...
|
|
45
88
|
</div>
|
|
46
89
|
```
|
|
47
90
|
|
|
48
|
-
|
|
91
|
+
#### JSX
|
|
92
|
+
|
|
93
|
+
```jsx
|
|
94
|
+
import { Cover } from '@inc2734/unitone-css';
|
|
95
|
+
|
|
96
|
+
<Cover padding={1}>
|
|
97
|
+
...
|
|
98
|
+
</Cover>
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Min height
|
|
102
|
+
|
|
103
|
+
Min height.
|
|
104
|
+
|
|
105
|
+
#### HTML
|
|
49
106
|
|
|
50
107
|
```html
|
|
51
|
-
<div data-unitone-layout="cover -
|
|
108
|
+
<div data-unitone-layout="cover" style="--unitone--min-height: 80vh">
|
|
52
109
|
...
|
|
53
110
|
</div>
|
|
54
111
|
```
|
|
55
112
|
|
|
56
|
-
|
|
113
|
+
#### JSX
|
|
114
|
+
|
|
115
|
+
```jsx
|
|
116
|
+
import { Cover } from '@inc2734/unitone-css';
|
|
117
|
+
|
|
118
|
+
<Cover minHeight="80vh">
|
|
119
|
+
...
|
|
120
|
+
</Cover>
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### Item position
|
|
124
|
+
|
|
125
|
+
You can specify the position of a child element.
|
|
57
126
|
|
|
58
|
-
|
|
127
|
+
#### HTML
|
|
59
128
|
|
|
60
129
|
```html
|
|
61
130
|
<div data-unitone-layout="cover">
|
|
62
|
-
<div data-unitone-layout="cover__content -position:
|
|
131
|
+
<div data-unitone-layout="cover__content -position:fixed" style="--unitone--top: 0; --unitone--right: 0; --unitone--bottom: 0; --unitone--left: 0; --uitone--z-index: 1">
|
|
63
132
|
...
|
|
64
133
|
</div>
|
|
134
|
+
|
|
65
135
|
<div data-unitone-layout="cover__content">
|
|
66
136
|
...
|
|
67
137
|
</div>
|
|
68
138
|
</div>
|
|
69
139
|
```
|
|
140
|
+
|
|
141
|
+
#### JSX
|
|
142
|
+
|
|
143
|
+
```jsx
|
|
144
|
+
import { Cover, CoverContent } from '@inc2734/unitone-css';
|
|
145
|
+
|
|
146
|
+
<Cover gap={1}>
|
|
147
|
+
<CoverContent position="fixed" top="0" right="0" bottom="0" left="0" zIndex="1">
|
|
148
|
+
...
|
|
149
|
+
</CoverContent>
|
|
150
|
+
|
|
151
|
+
<CoverContent>
|
|
152
|
+
...
|
|
153
|
+
</CoverContent>
|
|
154
|
+
</Cover>
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### Item valign
|
|
158
|
+
|
|
159
|
+
You can specify the vertical position of a child element.
|
|
160
|
+
|
|
161
|
+
#### HTML
|
|
162
|
+
|
|
163
|
+
```html
|
|
164
|
+
<div data-unitone-layout="decorator" style="--unitone--background-color: #000; --unitone--color: #fff; --unitone--padding: 0">
|
|
165
|
+
<div data-unitone-layout="cover">
|
|
166
|
+
<div data-unitone-layout="cover__content valign:top">
|
|
167
|
+
Lorem ipsum
|
|
168
|
+
</div>
|
|
169
|
+
|
|
170
|
+
<div data-unitone-layout="cover__content valign:bottom">
|
|
171
|
+
Lorem ipsum
|
|
172
|
+
</div>
|
|
173
|
+
</div>
|
|
174
|
+
</div>
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
#### JSX
|
|
178
|
+
|
|
179
|
+
```jsx
|
|
180
|
+
import { Decorator, Cover, CoverContent } from '@inc2734/unitone-css';
|
|
181
|
+
|
|
182
|
+
<Decorator backgroundColor="#000" color="#fff" padding={0}>
|
|
183
|
+
<Cover>
|
|
184
|
+
<CoverContent valign="top">
|
|
185
|
+
Lorem ipsum
|
|
186
|
+
</CoverContent>
|
|
187
|
+
|
|
188
|
+
<CoverContent valign="bottom">
|
|
189
|
+
Lorem ipsum
|
|
190
|
+
</CoverContent>
|
|
191
|
+
|
|
192
|
+
<p>sed do</p>
|
|
193
|
+
</Cover>
|
|
194
|
+
</Decorator>
|
|
195
|
+
```
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
--unitone--gap: var(--unitone--global--gap);
|
|
3
3
|
--unitone--padding: var(--unitone--gap);
|
|
4
4
|
--unitone--min-height: 100vh;
|
|
5
|
-
--unitone--justify-content: center;
|
|
6
5
|
|
|
7
6
|
display: flex;
|
|
8
7
|
flex-direction: column;
|
|
@@ -15,6 +14,7 @@
|
|
|
15
14
|
margin-bottom: 0;
|
|
16
15
|
}
|
|
17
16
|
|
|
17
|
+
// @deprecated
|
|
18
18
|
&[data-unitone-layout~="-no-padding"] {
|
|
19
19
|
padding: 0;
|
|
20
20
|
}
|
|
@@ -36,6 +36,29 @@
|
|
|
36
36
|
z-index: var(--unitone--z-index);
|
|
37
37
|
margin-top: auto;
|
|
38
38
|
margin-bottom: auto;
|
|
39
|
+
|
|
40
|
+
&[data-unitone-layout~="-valign:top"] {
|
|
41
|
+
margin-top: 0;
|
|
42
|
+
margin-bottom: auto;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
&[data-unitone-layout~="-valign:center"] {
|
|
46
|
+
margin-top: auto;
|
|
47
|
+
margin-bottom: auto;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
&[data-unitone-layout~="-valign:bottom"] {
|
|
51
|
+
margin-top: auto;
|
|
52
|
+
margin-bottom: 0;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
&[data-unitone-layout~="-valign:top"] + &[data-unitone-layout~="-valign:center"] {
|
|
56
|
+
margin-top: 0;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
&[data-unitone-layout~="-valign:center"] + &[data-unitone-layout~="-valign:bottom"] {
|
|
60
|
+
margin-top: 0;
|
|
61
|
+
}
|
|
39
62
|
}
|
|
40
63
|
|
|
41
64
|
@mixin cover() {
|
|
@@ -45,28 +68,5 @@
|
|
|
45
68
|
|
|
46
69
|
[data-unitone-layout~="cover__content"] {
|
|
47
70
|
@include abstract-cover__content();
|
|
48
|
-
|
|
49
|
-
&[data-unitone-layout~="-valign:top"] {
|
|
50
|
-
margin-top: 0;
|
|
51
|
-
margin-bottom: auto;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
&[data-unitone-layout~="-valign:center"] {
|
|
55
|
-
margin-top: auto;
|
|
56
|
-
margin-bottom: auto;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
&[data-unitone-layout~="-valign:bottom"] {
|
|
60
|
-
margin-top: auto;
|
|
61
|
-
margin-bottom: 0;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
&[data-unitone-layout~="-valign:top"] + [data-unitone-layout~="cover__content"][data-unitone-layout~="-valign:center"] {
|
|
65
|
-
margin-top: 0;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
&[data-unitone-layout~="-valign:center"] + [data-unitone-layout~="cover__content"][data-unitone-layout~="-valign:bottom"] {
|
|
69
|
-
margin-top: 0;
|
|
70
|
-
}
|
|
71
71
|
}
|
|
72
72
|
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
export const Cover = ({ gap, minHeight, justifyContent, padding, noPadding, style, ...props }) => {
|
|
4
|
+
style = {
|
|
5
|
+
...style,
|
|
6
|
+
'--unitone--min-height': !!minHeight ? minHeight : undefined,
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
return (
|
|
10
|
+
<div
|
|
11
|
+
data-unitone-layout={[
|
|
12
|
+
'cover',
|
|
13
|
+
noPadding ? '-no-padding' : undefined,
|
|
14
|
+
'undefined' !== typeof gap ? `-gap:${gap}` : undefined,
|
|
15
|
+
'undefined' !== typeof padding ? `-padding:${padding}` : undefined,
|
|
16
|
+
]
|
|
17
|
+
.filter(Boolean)
|
|
18
|
+
.join(' ')}
|
|
19
|
+
style={style}
|
|
20
|
+
>
|
|
21
|
+
{props.children}
|
|
22
|
+
</div>
|
|
23
|
+
);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export const CoverContent = ({
|
|
27
|
+
valign,
|
|
28
|
+
position,
|
|
29
|
+
top,
|
|
30
|
+
right,
|
|
31
|
+
bottom,
|
|
32
|
+
left,
|
|
33
|
+
zIndex,
|
|
34
|
+
tagName = 'div',
|
|
35
|
+
style,
|
|
36
|
+
...props
|
|
37
|
+
}) => {
|
|
38
|
+
const Tag = tagName;
|
|
39
|
+
|
|
40
|
+
style = {
|
|
41
|
+
...style,
|
|
42
|
+
'--unitone--top': 'undefined' !== typeof top ? top : undefined,
|
|
43
|
+
'--unitone--right': 'undefined' !== typeof right ? right : undefined,
|
|
44
|
+
'--unitone--bottom': 'undefined' !== typeof bottom ? bottom : undefined,
|
|
45
|
+
'--unitone--left': 'undefined' !== typeof left ? left : undefined,
|
|
46
|
+
'--unitone--z-index': 'undefined' !== typeof zIndex ? zIndex : undefined,
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<Tag
|
|
51
|
+
data-unitone-layout={[
|
|
52
|
+
'cover__content',
|
|
53
|
+
'undefined' !== typeof valign ? `-valign:${valign}` : undefined,
|
|
54
|
+
'undefined' !== typeof position ? `-position:${position}` : undefined,
|
|
55
|
+
]
|
|
56
|
+
.filter(Boolean)
|
|
57
|
+
.join(' ')}
|
|
58
|
+
style={style}
|
|
59
|
+
>
|
|
60
|
+
{props.children}
|
|
61
|
+
</Tag>
|
|
62
|
+
);
|
|
63
|
+
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import readme from '../README.md';
|
|
3
3
|
|
|
4
|
-
import { Cover, CoverContent } from '../
|
|
5
|
-
import { Decorator } from '../../decorator
|
|
6
|
-
import { Stack } from '../../stack
|
|
4
|
+
import { Cover, CoverContent } from '../';
|
|
5
|
+
import { Decorator } from '../../decorator';
|
|
6
|
+
import { Stack } from '../../stack';
|
|
7
7
|
|
|
8
8
|
export default {
|
|
9
9
|
title: 'Layout Primitives/Cover',
|
|
@@ -20,24 +20,25 @@ export default {
|
|
|
20
20
|
table: { defaultValue: { summary: 'var(--unitone--global--gap)' } },
|
|
21
21
|
type: { name: 'number', required: false },
|
|
22
22
|
},
|
|
23
|
+
padding: {
|
|
24
|
+
control: { type: 'inline-radio' },
|
|
25
|
+
description:
|
|
26
|
+
'Padding. Set by CSS var `--unitone--padding` or `data-unitone-layout` attribute `-padding:x`.',
|
|
27
|
+
options: [-2, -1, 0, 1, 2, 3, 4, 5, 6, 7],
|
|
28
|
+
table: { defaultValue: { summary: '0var(--unitone--global--gap)' } },
|
|
29
|
+
type: { name: 'number', required: false },
|
|
30
|
+
},
|
|
23
31
|
minHeight: {
|
|
24
32
|
control: { type: 'text' },
|
|
25
33
|
description: 'Min height. Set by CSS var `--unitone--min-height`.',
|
|
26
34
|
table: { defaultValue: { summary: '100vh' } },
|
|
27
35
|
type: { name: 'string', required: false },
|
|
28
36
|
},
|
|
29
|
-
noPadding: {
|
|
30
|
-
control: { type: 'inline-radio' },
|
|
31
|
-
description: 'Remove padding.',
|
|
32
|
-
options: [false, true],
|
|
33
|
-
table: { defaultValue: { summary: 'false' } },
|
|
34
|
-
type: { name: 'boolean', required: false },
|
|
35
|
-
},
|
|
36
37
|
},
|
|
37
38
|
args: {
|
|
38
39
|
gap: 2,
|
|
40
|
+
padding: 2,
|
|
39
41
|
minHeight: '100vh',
|
|
40
|
-
noPadding: false,
|
|
41
42
|
},
|
|
42
43
|
};
|
|
43
44
|
|
|
@@ -65,7 +66,7 @@ export const ExampleHeader = (args) => {
|
|
|
65
66
|
return (
|
|
66
67
|
<Decorator backgroundColor="#000" color="#fff">
|
|
67
68
|
<Cover {...args}>
|
|
68
|
-
<CoverContent
|
|
69
|
+
<CoverContent valign="top">
|
|
69
70
|
<Stack>
|
|
70
71
|
<h1 style={{ '--unitone--font-size': 6 }}>Lorem ipsum dolor sit amet</h1>
|
|
71
72
|
<p>
|
|
@@ -87,7 +88,7 @@ export const ExampleFooter = (args) => {
|
|
|
87
88
|
return (
|
|
88
89
|
<Decorator backgroundColor="#000" color="#fff">
|
|
89
90
|
<Cover {...args}>
|
|
90
|
-
<CoverContent
|
|
91
|
+
<CoverContent valign="bottom">
|
|
91
92
|
<Stack>
|
|
92
93
|
<h1 style={{ '--unitone--font-size': 6 }}>Lorem ipsum dolor sit amet</h1>
|
|
93
94
|
<p>
|
|
@@ -109,11 +110,11 @@ export const ExampleHeaderFooter = (args) => {
|
|
|
109
110
|
return (
|
|
110
111
|
<Decorator backgroundColor="#000" color="#fff">
|
|
111
112
|
<Cover {...args}>
|
|
112
|
-
<CoverContent
|
|
113
|
+
<CoverContent valign="top">
|
|
113
114
|
<p>Lorem ipsum</p>
|
|
114
115
|
</CoverContent>
|
|
115
116
|
|
|
116
|
-
<CoverContent
|
|
117
|
+
<CoverContent valign="bottom">
|
|
117
118
|
<p>Lorem ipsum</p>
|
|
118
119
|
</CoverContent>
|
|
119
120
|
</Cover>
|
|
@@ -129,11 +130,11 @@ export const ExampleHeaderCenter = (args) => {
|
|
|
129
130
|
return (
|
|
130
131
|
<Decorator backgroundColor="#000" color="#fff">
|
|
131
132
|
<Cover {...args}>
|
|
132
|
-
<CoverContent
|
|
133
|
+
<CoverContent valign="top">
|
|
133
134
|
<p>Lorem ipsum</p>
|
|
134
135
|
</CoverContent>
|
|
135
136
|
|
|
136
|
-
<CoverContent
|
|
137
|
+
<CoverContent valign="center">
|
|
137
138
|
<Stack>
|
|
138
139
|
<h1 style={{ '--unitone--font-size': 6 }}>Lorem ipsum dolor sit amet</h1>
|
|
139
140
|
<p>
|
|
@@ -155,7 +156,7 @@ export const ExampleCenterFooter = (args) => {
|
|
|
155
156
|
return (
|
|
156
157
|
<Decorator backgroundColor="#000" color="#fff">
|
|
157
158
|
<Cover {...args}>
|
|
158
|
-
<CoverContent
|
|
159
|
+
<CoverContent valign="center">
|
|
159
160
|
<Stack>
|
|
160
161
|
<h1 style={{ '--unitone--font-size': 6 }}>Lorem ipsum dolor sit amet</h1>
|
|
161
162
|
<p>
|
|
@@ -165,7 +166,7 @@ export const ExampleCenterFooter = (args) => {
|
|
|
165
166
|
</Stack>
|
|
166
167
|
</CoverContent>
|
|
167
168
|
|
|
168
|
-
<CoverContent
|
|
169
|
+
<CoverContent valign="bottom">
|
|
169
170
|
<p>Lorem ipsum</p>
|
|
170
171
|
</CoverContent>
|
|
171
172
|
</Cover>
|