@inc2734/unitone-css 0.23.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/LICENSE +21 -0
- package/README.md +18 -0
- package/dist/app.css +1 -0
- package/dist/app.js +1 -0
- package/dist/storybook.css +1 -0
- package/package.json +60 -0
- package/src/.DS_Store +0 -0
- package/src/app.js +21 -0
- package/src/app.scss +8 -0
- package/src/foundation/_foundation.scss +108 -0
- package/src/helper/_align-items.scss +7 -0
- package/src/helper/_align-self.scss +17 -0
- package/src/helper/_align.scss +14 -0
- package/src/helper/_fluid-typography.scss +7 -0
- package/src/helper/_gap.scss +7 -0
- package/src/helper/_gutters.scss +7 -0
- package/src/helper/_helper.scss +21 -0
- package/src/helper/_justify-content.scss +7 -0
- package/src/helper/_justify-self.scss +17 -0
- package/src/helper/_padding.scss +7 -0
- package/src/layout-primitives/_layout-primitives.scss +33 -0
- package/src/layout-primitives/both-sides/BothSides.jsx +22 -0
- package/src/layout-primitives/both-sides/README.md +54 -0
- package/src/layout-primitives/both-sides/_both-sides.scss +24 -0
- package/src/layout-primitives/both-sides/stories/index.jsx +51 -0
- package/src/layout-primitives/center/Center.jsx +18 -0
- package/src/layout-primitives/center/README.md +33 -0
- package/src/layout-primitives/center/_center.scss +17 -0
- package/src/layout-primitives/center/stories/index.jsx +39 -0
- package/src/layout-primitives/cluster/Cluster.jsx +21 -0
- package/src/layout-primitives/cluster/README.md +35 -0
- package/src/layout-primitives/cluster/_cluster.scss +22 -0
- package/src/layout-primitives/cluster/stories/index.jsx +79 -0
- package/src/layout-primitives/container/Container.jsx +23 -0
- package/src/layout-primitives/container/README.md +39 -0
- package/src/layout-primitives/container/_container.scss +18 -0
- package/src/layout-primitives/container/stories/index.jsx +65 -0
- package/src/layout-primitives/cover/Cover.jsx +30 -0
- package/src/layout-primitives/cover/README.md +54 -0
- package/src/layout-primitives/cover/_cover.scss +37 -0
- package/src/layout-primitives/cover/stories/index.jsx +140 -0
- package/src/layout-primitives/decorator/Decorator.jsx +49 -0
- package/src/layout-primitives/decorator/README.md +49 -0
- package/src/layout-primitives/decorator/_decorator.scss +54 -0
- package/src/layout-primitives/decorator/stories/index.jsx +190 -0
- package/src/layout-primitives/float/Float.jsx +24 -0
- package/src/layout-primitives/float/README.md +24 -0
- package/src/layout-primitives/float/_float.scss +29 -0
- package/src/layout-primitives/float/stories/index.jsx +78 -0
- package/src/layout-primitives/frame/Frame.jsx +19 -0
- package/src/layout-primitives/frame/README.md +7 -0
- package/src/layout-primitives/frame/_frame.scss +45 -0
- package/src/layout-primitives/frame/stories/index.jsx +50 -0
- package/src/layout-primitives/gutters/Gutters.jsx +17 -0
- package/src/layout-primitives/gutters/README.md +23 -0
- package/src/layout-primitives/gutters/_gutters.scss +12 -0
- package/src/layout-primitives/gutters/stories/index.jsx +48 -0
- package/src/layout-primitives/layers/Layers.jsx +18 -0
- package/src/layout-primitives/layers/README.md +32 -0
- package/src/layout-primitives/layers/_layers.scss +51 -0
- package/src/layout-primitives/layers/stories/index.jsx +133 -0
- package/src/layout-primitives/responsive-grid/README.md +11 -0
- package/src/layout-primitives/responsive-grid/ResponsiveGrid.jsx +22 -0
- package/src/layout-primitives/responsive-grid/_responsive-grid.scss +14 -0
- package/src/layout-primitives/responsive-grid/stories/index.jsx +65 -0
- package/src/layout-primitives/stack/README.md +24 -0
- package/src/layout-primitives/stack/Stack.jsx +22 -0
- package/src/layout-primitives/stack/_stack.scss +31 -0
- package/src/layout-primitives/stack/stories/index.jsx +123 -0
- package/src/layout-primitives/switcher/README.md +17 -0
- package/src/layout-primitives/switcher/Switcher.jsx +19 -0
- package/src/layout-primitives/switcher/_switcher.scss +19 -0
- package/src/layout-primitives/switcher/stories/index.jsx +50 -0
- package/src/layout-primitives/text/README.md +16 -0
- package/src/layout-primitives/text/Text.jsx +19 -0
- package/src/layout-primitives/text/_text.scss +80 -0
- package/src/layout-primitives/text/stories/index.jsx +112 -0
- package/src/layout-primitives/with-sidebar/README.md +36 -0
- package/src/layout-primitives/with-sidebar/WithSidebar.jsx +35 -0
- package/src/layout-primitives/with-sidebar/_with-sidebar.scss +58 -0
- package/src/layout-primitives/with-sidebar/stories/index.jsx +127 -0
- package/src/patterns/features/features-1/Features1.jsx +52 -0
- package/src/patterns/features/features-1/stories/index.jsx +68 -0
- package/src/patterns/features/features-2/Features2.jsx +33 -0
- package/src/patterns/features/features-2/stories/index.jsx +67 -0
- package/src/patterns/header/header-1/Header1.jsx +31 -0
- package/src/patterns/header/header-1/stories/index.jsx +44 -0
- package/src/patterns/header/header-2/Header2.jsx +33 -0
- package/src/patterns/header/header-2/stories/index.jsx +44 -0
- package/src/patterns/header/header-3/Header3.jsx +30 -0
- package/src/patterns/header/header-3/stories/index.jsx +43 -0
- package/src/patterns/header/header-4/Header4.jsx +25 -0
- package/src/patterns/header/header-4/stories/index.jsx +41 -0
- package/src/patterns/header/header-5/Header5.jsx +32 -0
- package/src/patterns/header/header-5/stories/index.jsx +43 -0
- package/src/patterns/header/header-6/Header6.jsx +34 -0
- package/src/patterns/header/header-6/stories/index.jsx +58 -0
- package/src/patterns/media-text/media-text-1/MediaText1.jsx +41 -0
- package/src/patterns/media-text/media-text-1/stories/index.jsx +34 -0
- package/src/patterns/media-text/media-text-2/MediaText2.jsx +39 -0
- package/src/patterns/media-text/media-text-2/stories/index.jsx +34 -0
- package/src/settings/_body.scss +8 -0
- package/src/settings/_html.scss +3 -0
- package/src/settings/_root.scss +152 -0
- package/src/settings/_settings.scss +3 -0
- package/src/stories/1.introduction.stories.mdx +27 -0
- package/src/stories/2.get-started.stories.mdx +23 -0
- package/src/stories/3.global-api.stories.mdx +57 -0
- package/src/storybook.scss +11 -0
- package/src/variables/_variables.scss +22 -0
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import readme from '../README.md';
|
|
3
|
+
|
|
4
|
+
import { Cover, CoverContent } from '../Cover';
|
|
5
|
+
import { Decorator } from '../../decorator/Decorator';
|
|
6
|
+
import { Stack } from '../../stack/Stack';
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
title: 'Layout Primitives/Cover',
|
|
10
|
+
component: Cover,
|
|
11
|
+
parameters: {
|
|
12
|
+
notes: { readme },
|
|
13
|
+
},
|
|
14
|
+
argTypes: {
|
|
15
|
+
gap: {
|
|
16
|
+
control: { type: 'inline-radio' },
|
|
17
|
+
description:
|
|
18
|
+
'Gap. Set by CSS var `--unitone--gap` or `data-unitone-layout` attribute `-gap:x`.',
|
|
19
|
+
options: [-2, -1, 0, 1, 2, 3, 4, 5, 6, 7],
|
|
20
|
+
table: { defaultValue: { summary: 'var(--unitone--s1)' } },
|
|
21
|
+
type: { name: 'number', required: false },
|
|
22
|
+
},
|
|
23
|
+
minHeight: {
|
|
24
|
+
control: { type: 'text' },
|
|
25
|
+
description: 'Min height. Set by CSS var `--unitone--min-height`.',
|
|
26
|
+
table: { defaultValue: { summary: '100vh' } },
|
|
27
|
+
type: { name: 'string', required: false },
|
|
28
|
+
},
|
|
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
|
+
justifyContent: {
|
|
37
|
+
control: { type: 'inline-radio' },
|
|
38
|
+
description:
|
|
39
|
+
'Alignment of the row direction. Set by CSS var `--unitone--justify-content` or `data-unitone-layout` attribute `-justify-content:x`.',
|
|
40
|
+
options: ['start', 'center', 'end', 'space-between'],
|
|
41
|
+
table: { defaultValue: { summary: 'start' } },
|
|
42
|
+
type: { name: 'string', required: false },
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
args: {
|
|
46
|
+
gap: 1,
|
|
47
|
+
minHeight: '100vh',
|
|
48
|
+
noPadding: false,
|
|
49
|
+
justifyContent: 'center',
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export const Default = (args) => {
|
|
54
|
+
return (
|
|
55
|
+
<Decorator backgroundColor="#000" color="#fff">
|
|
56
|
+
<Cover {...args}>
|
|
57
|
+
<p>Lorem ipsum</p>
|
|
58
|
+
<CoverContent>
|
|
59
|
+
<Stack>
|
|
60
|
+
<h1 style={{ '--unitone--font-size': 6 }}>Lorem ipsum dolor sit amet</h1>
|
|
61
|
+
<p>
|
|
62
|
+
consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore
|
|
63
|
+
magna aliqua.
|
|
64
|
+
</p>
|
|
65
|
+
</Stack>
|
|
66
|
+
</CoverContent>
|
|
67
|
+
<p>Lorem ipsum</p>
|
|
68
|
+
</Cover>
|
|
69
|
+
</Decorator>
|
|
70
|
+
);
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export const ExampleNoHeader = (args) => {
|
|
74
|
+
return (
|
|
75
|
+
<Decorator backgroundColor="#000" color="#fff">
|
|
76
|
+
<Cover {...args}>
|
|
77
|
+
<CoverContent>
|
|
78
|
+
<Stack>
|
|
79
|
+
<h1 style={{ '--unitone--font-size': 6 }}>Lorem ipsum dolor sit amet</h1>
|
|
80
|
+
<p>
|
|
81
|
+
consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore
|
|
82
|
+
magna aliqua.
|
|
83
|
+
</p>
|
|
84
|
+
</Stack>
|
|
85
|
+
</CoverContent>
|
|
86
|
+
<p>sed do</p>
|
|
87
|
+
</Cover>
|
|
88
|
+
</Decorator>
|
|
89
|
+
);
|
|
90
|
+
};
|
|
91
|
+
ExampleNoHeader.storyName = 'Example : No header';
|
|
92
|
+
ExampleNoHeader.args = {
|
|
93
|
+
minHeight: '80vh',
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
export const ExampleNoFooter = (args) => {
|
|
97
|
+
return (
|
|
98
|
+
<Decorator backgroundColor="#000" color="#fff">
|
|
99
|
+
<Cover {...args}>
|
|
100
|
+
<p>Lorem ipsum</p>
|
|
101
|
+
<CoverContent>
|
|
102
|
+
<Stack>
|
|
103
|
+
<h1 style={{ '--unitone--font-size': 6 }}>Lorem ipsum dolor sit amet</h1>
|
|
104
|
+
<p>
|
|
105
|
+
consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore
|
|
106
|
+
magna aliqua.
|
|
107
|
+
</p>
|
|
108
|
+
</Stack>
|
|
109
|
+
</CoverContent>
|
|
110
|
+
</Cover>
|
|
111
|
+
</Decorator>
|
|
112
|
+
);
|
|
113
|
+
};
|
|
114
|
+
ExampleNoFooter.storyName = 'Example : No footer';
|
|
115
|
+
ExampleNoFooter.args = {
|
|
116
|
+
minHeight: '80vh',
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
export const ExampleFooter = (args) => {
|
|
120
|
+
return (
|
|
121
|
+
<Decorator backgroundColor="#000" color="#fff">
|
|
122
|
+
<Cover {...args}>
|
|
123
|
+
<CoverContent>
|
|
124
|
+
<p>Lorem ipsum</p>
|
|
125
|
+
</CoverContent>
|
|
126
|
+
<Stack>
|
|
127
|
+
<h1 style={{ '--unitone--font-size': 6 }}>Lorem ipsum dolor sit amet</h1>
|
|
128
|
+
<p>
|
|
129
|
+
consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna
|
|
130
|
+
aliqua.
|
|
131
|
+
</p>
|
|
132
|
+
</Stack>
|
|
133
|
+
</Cover>
|
|
134
|
+
</Decorator>
|
|
135
|
+
);
|
|
136
|
+
};
|
|
137
|
+
ExampleFooter.storyName = 'Example : Footer';
|
|
138
|
+
ExampleFooter.args = {
|
|
139
|
+
minHeight: '80vh',
|
|
140
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
export const Decorator = ({
|
|
4
|
+
backgroundColor,
|
|
5
|
+
borderColor,
|
|
6
|
+
borderRadius,
|
|
7
|
+
borderWidth,
|
|
8
|
+
color,
|
|
9
|
+
padding,
|
|
10
|
+
shadow,
|
|
11
|
+
position,
|
|
12
|
+
top,
|
|
13
|
+
right,
|
|
14
|
+
bottom,
|
|
15
|
+
left,
|
|
16
|
+
zIndex,
|
|
17
|
+
style,
|
|
18
|
+
...props
|
|
19
|
+
}) => {
|
|
20
|
+
style = {
|
|
21
|
+
...style,
|
|
22
|
+
'--unitone--background-color': backgroundColor,
|
|
23
|
+
'--unitone--border-color': borderColor,
|
|
24
|
+
'--unitone--border-radius': borderRadius,
|
|
25
|
+
'--unitone--border-width': borderWidth,
|
|
26
|
+
'--unitone--color': color,
|
|
27
|
+
'--unitone--top': 'undefined' !== typeof top ? top : undefined,
|
|
28
|
+
'--unitone--right': 'undefined' !== typeof right ? right : undefined,
|
|
29
|
+
'--unitone--bottom': 'undefined' !== typeof bottom ? bottom : undefined,
|
|
30
|
+
'--unitone--left': 'undefined' !== typeof left ? left : undefined,
|
|
31
|
+
'--unitone--z-index': 'undefined' !== typeof zIndex ? zIndex : undefined,
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<div
|
|
36
|
+
data-unitone-layout={[
|
|
37
|
+
'decorator',
|
|
38
|
+
'undefined' !== typeof padding ? `-padding:${padding}` : undefined,
|
|
39
|
+
!!shadow ? '-shadow' : undefined,
|
|
40
|
+
!!position ? `-position:${position}` : undefined,
|
|
41
|
+
]
|
|
42
|
+
.filter(Boolean)
|
|
43
|
+
.join(' ')}
|
|
44
|
+
style={style}
|
|
45
|
+
>
|
|
46
|
+
{props.children}
|
|
47
|
+
</div>
|
|
48
|
+
);
|
|
49
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
## Usage
|
|
2
|
+
|
|
3
|
+
```html
|
|
4
|
+
<div data-unitone-layout="decorator">
|
|
5
|
+
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
|
|
6
|
+
</div>
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
### Customizing padding
|
|
10
|
+
|
|
11
|
+
```html
|
|
12
|
+
<div data-unitone-layout="decorator -padding:1">
|
|
13
|
+
...
|
|
14
|
+
</div>
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
### With shadow
|
|
18
|
+
|
|
19
|
+
```html
|
|
20
|
+
<div data-unitone-layout="decorator -shadow">
|
|
21
|
+
...
|
|
22
|
+
</div>
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### Customizing position
|
|
26
|
+
|
|
27
|
+
After the `position`, specify the position with `-position:{position}`.
|
|
28
|
+
|
|
29
|
+
```html
|
|
30
|
+
<div data-unitone-layout="decorator -position:relative">
|
|
31
|
+
...
|
|
32
|
+
</div>
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Customizing offset
|
|
36
|
+
|
|
37
|
+
```html
|
|
38
|
+
<div data-unitone-layout="decorator -position:relative" style="--unitone--top: 1px; --unitone--right: 1px; --unitone--bottom: 1px; --unitone--left: 1px">
|
|
39
|
+
...
|
|
40
|
+
</div>
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Customizing z-index
|
|
44
|
+
|
|
45
|
+
```html
|
|
46
|
+
<div data-unitone-layout="decorator -position:relative" style="--unitone--z-index: 1">
|
|
47
|
+
...
|
|
48
|
+
</div>
|
|
49
|
+
```
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
@mixin abstract-decorator() {
|
|
2
|
+
--unitone--background-color: transparent;
|
|
3
|
+
// --unitone--color: var(--unitone--color-text); // Comment out if you don't want it to be inherited.
|
|
4
|
+
--unitone--border-color: transparent;
|
|
5
|
+
--unitone--border-width: 0;
|
|
6
|
+
--unitone--border-radius: 0;
|
|
7
|
+
--unitone--padding: var(--unitone--s0);
|
|
8
|
+
--unitone--box-shadow: none;
|
|
9
|
+
--unitone--position: static;
|
|
10
|
+
--unitone--top: initial;
|
|
11
|
+
--unitone--right: initial;
|
|
12
|
+
--unitone--bottom: initial;
|
|
13
|
+
--unitone--left: initial;
|
|
14
|
+
--unitone--z-index: initial;
|
|
15
|
+
|
|
16
|
+
padding: calc((var(--unitone--padding) - var(--unitone--half-leading) * 1em)) var(--unitone--padding);
|
|
17
|
+
border: var(--unitone--border-width) solid var(--unitone--border-color);
|
|
18
|
+
border-radius: var(--unitone--border-radius);
|
|
19
|
+
color: var(--unitone--color);
|
|
20
|
+
background-color: var(--unitone--background-color);
|
|
21
|
+
box-shadow: var(--unitone--box-shadow);
|
|
22
|
+
position: var(--unitone--position);
|
|
23
|
+
top: var(--unitone--top);
|
|
24
|
+
right: var(--unitone--right);
|
|
25
|
+
bottom: var(--unitone--bottom);
|
|
26
|
+
left: var(--unitone--left);
|
|
27
|
+
z-index: var(--unitone--z-index);
|
|
28
|
+
|
|
29
|
+
&[data-unitone-layout~="-shadow"] {
|
|
30
|
+
--unitone--box-shadow: var(--unitone--shadow);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
&[data-unitone-layout~="-position\:relative"] {
|
|
34
|
+
--unitone--position: relative !important;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
&[data-unitone-layout~="-position\:absolute"] {
|
|
38
|
+
--unitone--position: absolute !important;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
&[data-unitone-layout~="-position\:sticky"] {
|
|
42
|
+
--unitone--position: sticky !important;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
&[data-unitone-layout~="-position\:fixed"] {
|
|
46
|
+
--unitone--position: fixed !important;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
@mixin decorator() {
|
|
51
|
+
[data-unitone-layout~="decorator"] {
|
|
52
|
+
@include abstract-decorator();
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import readme from '../README.md';
|
|
3
|
+
|
|
4
|
+
import { Decorator } from '../Decorator';
|
|
5
|
+
import { Stack } from '../../stack/Stack';
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
title: 'Layout Primitives/Decorator',
|
|
9
|
+
component: Decorator,
|
|
10
|
+
parameters: {
|
|
11
|
+
notes: { readme },
|
|
12
|
+
},
|
|
13
|
+
argTypes: {
|
|
14
|
+
backgroundColor: {
|
|
15
|
+
control: { type: 'color' },
|
|
16
|
+
description: 'Background color. Set by CSS var `--unitone--background-color`.',
|
|
17
|
+
table: { defaultValue: { summary: 'transparent' } },
|
|
18
|
+
type: { name: 'string', required: false },
|
|
19
|
+
},
|
|
20
|
+
borderColor: {
|
|
21
|
+
control: { type: 'color' },
|
|
22
|
+
description: 'Border color. Set by CSS var `--unitone--border-color`.',
|
|
23
|
+
table: { defaultValue: { summary: 'transparent' } },
|
|
24
|
+
type: { name: 'string', required: false },
|
|
25
|
+
},
|
|
26
|
+
borderRadius: {
|
|
27
|
+
control: { type: 'text' },
|
|
28
|
+
description: 'Border radius. Set by CSS var `--unitone--border-radius`.',
|
|
29
|
+
table: { defaultValue: { summary: '0' } },
|
|
30
|
+
type: { name: 'string', required: false },
|
|
31
|
+
},
|
|
32
|
+
borderWidth: {
|
|
33
|
+
control: { type: 'text' },
|
|
34
|
+
description: 'Border width. Set by CSS var `--unitone--border-width`.',
|
|
35
|
+
table: { defaultValue: { summary: '0' } },
|
|
36
|
+
type: { name: 'string', required: false },
|
|
37
|
+
},
|
|
38
|
+
color: {
|
|
39
|
+
control: { type: 'color' },
|
|
40
|
+
description: 'Text color. Set by CSS var `--unitone--color`.',
|
|
41
|
+
table: { defaultValue: { summary: 'initial' } },
|
|
42
|
+
type: { name: 'string', required: false },
|
|
43
|
+
},
|
|
44
|
+
padding: {
|
|
45
|
+
control: { type: 'inline-radio' },
|
|
46
|
+
description:
|
|
47
|
+
'Padding. Set by CSS var `--unitone--padding` or `data-unitone-layout` attribute `-padding:x`.',
|
|
48
|
+
options: [-2, -1, 0, 1, 2, 3, 4, 5, 6, 7],
|
|
49
|
+
table: { defaultValue: { summary: 'var(--unitone--s0)' } },
|
|
50
|
+
type: { name: 'number', required: false },
|
|
51
|
+
},
|
|
52
|
+
shadow: {
|
|
53
|
+
control: { type: 'inline-radio' },
|
|
54
|
+
description: 'With `box-shadow`.',
|
|
55
|
+
options: [false, true],
|
|
56
|
+
table: { defaultValue: { summary: false } },
|
|
57
|
+
type: { name: 'boolean', required: false },
|
|
58
|
+
},
|
|
59
|
+
position: {
|
|
60
|
+
control: { type: 'inline-radio' },
|
|
61
|
+
description: 'The position value.',
|
|
62
|
+
options: ['static', 'relative', 'absolute', 'sticky', 'fixed'],
|
|
63
|
+
table: { defaultValue: { summary: 'static' } },
|
|
64
|
+
type: { name: 'string', required: false },
|
|
65
|
+
},
|
|
66
|
+
top: {
|
|
67
|
+
control: { type: 'text' },
|
|
68
|
+
description: 'Offset top.',
|
|
69
|
+
table: { defaultValue: { summary: 'initial' } },
|
|
70
|
+
type: { name: 'string', required: false },
|
|
71
|
+
},
|
|
72
|
+
right: {
|
|
73
|
+
control: { type: 'text' },
|
|
74
|
+
description: 'Offset right.',
|
|
75
|
+
table: { defaultValue: { summary: 'initial' } },
|
|
76
|
+
type: { name: 'string', required: false },
|
|
77
|
+
},
|
|
78
|
+
bottom: {
|
|
79
|
+
control: { type: 'text' },
|
|
80
|
+
description: 'Offset bottom.',
|
|
81
|
+
table: { defaultValue: { summary: 'initial' } },
|
|
82
|
+
type: { name: 'string', required: false },
|
|
83
|
+
},
|
|
84
|
+
left: {
|
|
85
|
+
control: { type: 'text' },
|
|
86
|
+
description: 'Offset left.',
|
|
87
|
+
table: { defaultValue: { summary: 'initial' } },
|
|
88
|
+
type: { name: 'string', required: false },
|
|
89
|
+
},
|
|
90
|
+
zIndex: {
|
|
91
|
+
control: { type: 'text' },
|
|
92
|
+
description: 'z-index.',
|
|
93
|
+
table: { defaultValue: { summary: 'initial' } },
|
|
94
|
+
type: { name: 'string', required: false },
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
args: {
|
|
98
|
+
backgroundColor: 'transarent',
|
|
99
|
+
borderColor: 'transparent',
|
|
100
|
+
borderRadius: '0px',
|
|
101
|
+
borderWidth: '0px',
|
|
102
|
+
color: 'initial',
|
|
103
|
+
padding: 0,
|
|
104
|
+
shadow: false,
|
|
105
|
+
position: 'static',
|
|
106
|
+
top: 'initial',
|
|
107
|
+
right: 'initial',
|
|
108
|
+
bottom: 'initial',
|
|
109
|
+
left: 'initial',
|
|
110
|
+
zIndex: 'initial',
|
|
111
|
+
},
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
const content =
|
|
115
|
+
'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';
|
|
116
|
+
|
|
117
|
+
export const Default = (args) => {
|
|
118
|
+
return (
|
|
119
|
+
<Decorator {...args}>
|
|
120
|
+
<p>{content}</p>
|
|
121
|
+
</Decorator>
|
|
122
|
+
);
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
export const ExampleShadow = (args) => {
|
|
126
|
+
return (
|
|
127
|
+
<Decorator {...args}>
|
|
128
|
+
<p>{content}</p>
|
|
129
|
+
</Decorator>
|
|
130
|
+
);
|
|
131
|
+
};
|
|
132
|
+
ExampleShadow.storyName = 'Example : Shadow';
|
|
133
|
+
ExampleShadow.argTypes = {
|
|
134
|
+
shadow: { table: { disable: true } },
|
|
135
|
+
};
|
|
136
|
+
ExampleShadow.args = {
|
|
137
|
+
padding: 1,
|
|
138
|
+
shadow: true,
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
export const ExampleCombobox = (args) => {
|
|
142
|
+
return (
|
|
143
|
+
<Decorator borderWidth={args.borderWidth} borderColor={args.backgroundColor}>
|
|
144
|
+
<Decorator
|
|
145
|
+
padding={args.padding}
|
|
146
|
+
backgroundColor={args.backgroundColor}
|
|
147
|
+
color="var(--unitone--color-white)"
|
|
148
|
+
>
|
|
149
|
+
Combo Box
|
|
150
|
+
</Decorator>
|
|
151
|
+
<Decorator padding={args.padding}>
|
|
152
|
+
<p>{content}</p>
|
|
153
|
+
</Decorator>
|
|
154
|
+
</Decorator>
|
|
155
|
+
);
|
|
156
|
+
};
|
|
157
|
+
ExampleCombobox.storyName = 'Example : Combobox';
|
|
158
|
+
ExampleCombobox.argTypes = {
|
|
159
|
+
color: { table: { disable: true } },
|
|
160
|
+
borderColor: { table: { disable: true } },
|
|
161
|
+
};
|
|
162
|
+
ExampleCombobox.args = {
|
|
163
|
+
padding: -1,
|
|
164
|
+
backgroundColor: '#000',
|
|
165
|
+
borderWidth: '1px',
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
export const ExamplePosition = (args) => {
|
|
169
|
+
return (
|
|
170
|
+
<Decorator position="relative">
|
|
171
|
+
<Stack>
|
|
172
|
+
<Decorator backgroundColor="#000" color="#fff" padding={1}>
|
|
173
|
+
{content}
|
|
174
|
+
</Decorator>
|
|
175
|
+
<Decorator {...args}>{content}</Decorator>
|
|
176
|
+
<Decorator backgroundColor="#000" color="#fff" padding={1}>
|
|
177
|
+
{content}
|
|
178
|
+
</Decorator>
|
|
179
|
+
</Stack>
|
|
180
|
+
</Decorator>
|
|
181
|
+
);
|
|
182
|
+
};
|
|
183
|
+
ExamplePosition.storyName = 'Example : Position';
|
|
184
|
+
ExamplePosition.args = {
|
|
185
|
+
padding: -1,
|
|
186
|
+
borderWidth: '1px',
|
|
187
|
+
backgroundColor: 'rgba(255, 0, 0, .7)',
|
|
188
|
+
position: 'absolute',
|
|
189
|
+
top: '100px',
|
|
190
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
export const Float = ({ gap, minWidth, minMeasure, position, style, ...props }) => {
|
|
4
|
+
style = {
|
|
5
|
+
...style,
|
|
6
|
+
'--unitone--min-width': !!minWidth ? minWidth : undefined,
|
|
7
|
+
'--unitone--min-measure': !!minMeasure ? minMeasure : undefined,
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
return (
|
|
11
|
+
<div
|
|
12
|
+
data-unitone-layout={[
|
|
13
|
+
'float',
|
|
14
|
+
!!position ? `-${position}` : undefined,
|
|
15
|
+
'undefined' !== typeof gap ? `-gap:${gap}` : undefined,
|
|
16
|
+
]
|
|
17
|
+
.filter(Boolean)
|
|
18
|
+
.join(' ')}
|
|
19
|
+
style={style}
|
|
20
|
+
>
|
|
21
|
+
{props.children}
|
|
22
|
+
</div>
|
|
23
|
+
);
|
|
24
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
## Usage
|
|
2
|
+
|
|
3
|
+
```html
|
|
4
|
+
<div data-unitone-layout="float">
|
|
5
|
+
<img src="https://placehold.jp/400x300.jpg" alt="" />
|
|
6
|
+
</div>
|
|
7
|
+
<p>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</p>
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
### Float right
|
|
11
|
+
|
|
12
|
+
```html
|
|
13
|
+
<div data-unitone-layout="float -right">
|
|
14
|
+
...
|
|
15
|
+
</div>
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
### Customizing gap
|
|
19
|
+
|
|
20
|
+
```html
|
|
21
|
+
<div data-unitone-layout="float -gap:1">
|
|
22
|
+
...
|
|
23
|
+
</div>
|
|
24
|
+
```
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
@mixin abstract-float() {
|
|
2
|
+
--unitone--gap: var(--unitone--s1);
|
|
3
|
+
--unitone--min-measure: calc(var(--unitone--measure) / 2);
|
|
4
|
+
--unitone--min-width: calc(var(--unitone--measure) / 2);
|
|
5
|
+
|
|
6
|
+
width: max(
|
|
7
|
+
min(var(--unitone--min-width), 100%),
|
|
8
|
+
min((var(--unitone--min-width) + var(--unitone--gap) + var(--unitone--min-measure) - 100%) * 999, 100%)
|
|
9
|
+
);
|
|
10
|
+
|
|
11
|
+
&[data-unitone-layout~="-left"],
|
|
12
|
+
&:not([data-unitone-layout~="-right"]) {
|
|
13
|
+
float: left;
|
|
14
|
+
margin-right: var(--unitone--gap);
|
|
15
|
+
margin-bottom: var(--unitone--gap);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
&[data-unitone-layout~="-right"] {
|
|
19
|
+
float: right;
|
|
20
|
+
margin-left: var(--unitone--gap);
|
|
21
|
+
margin-bottom: var(--unitone--gap);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
@mixin float() {
|
|
26
|
+
[data-unitone-layout~="float"] {
|
|
27
|
+
@include abstract-float();
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import readme from '../README.md';
|
|
3
|
+
|
|
4
|
+
import { Float } from '../Float';
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: 'Layout Primitives/Float',
|
|
8
|
+
component: Float,
|
|
9
|
+
parameters: {
|
|
10
|
+
notes: { readme },
|
|
11
|
+
},
|
|
12
|
+
argTypes: {
|
|
13
|
+
gap: {
|
|
14
|
+
control: { type: 'inline-radio' },
|
|
15
|
+
description:
|
|
16
|
+
'Gap between items. Set by CSS var `--unitone--gap` or `data-unitone-layout` attribute `-gap:x`.',
|
|
17
|
+
options: [-2, -1, 0, 1, 2, 3, 4, 5, 6, 7],
|
|
18
|
+
table: { defaultValue: { summary: 'var(--unitone--s1)' } },
|
|
19
|
+
type: { name: 'number', required: false },
|
|
20
|
+
},
|
|
21
|
+
minMeasure: {
|
|
22
|
+
control: { type: 'text' },
|
|
23
|
+
description:
|
|
24
|
+
'Min size of the item following the floating item. Set by CSS var `--unitone--min-measure`.',
|
|
25
|
+
table: { defaultValue: { summary: 'calc(var(--unitone--measure) / 2)' } },
|
|
26
|
+
type: { name: 'string', required: false },
|
|
27
|
+
},
|
|
28
|
+
minWidth: {
|
|
29
|
+
control: { type: 'text' },
|
|
30
|
+
description: 'Min size of the floating item. Set by CSS var `--unitone--min-width`.',
|
|
31
|
+
table: { defaultValue: { summary: 'calc(var(--unitone--measure) / 2)' } },
|
|
32
|
+
type: { name: 'string', required: false },
|
|
33
|
+
},
|
|
34
|
+
position: {
|
|
35
|
+
control: { type: 'inline-radio' },
|
|
36
|
+
description:
|
|
37
|
+
'The floating item position. Set by `data-unitone-layout` attribute `-right` or `-left`.',
|
|
38
|
+
options: ['left', 'right'],
|
|
39
|
+
table: { defaultValue: { summary: 'left' } },
|
|
40
|
+
type: { name: 'string', required: false },
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
args: {
|
|
44
|
+
gap: 1,
|
|
45
|
+
minMeasure: 'calc(var(--unitone--measure) / 2)',
|
|
46
|
+
minWidth: 'calc(var(--unitone--measure) / 2)',
|
|
47
|
+
position: 'left',
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const content =
|
|
52
|
+
'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';
|
|
53
|
+
|
|
54
|
+
export const Default = (args) => {
|
|
55
|
+
return (
|
|
56
|
+
<>
|
|
57
|
+
<Float {...args}>
|
|
58
|
+
<img src="https://placehold.jp/400x300.jpg" alt="" />
|
|
59
|
+
</Float>
|
|
60
|
+
<p>{content}</p>
|
|
61
|
+
</>
|
|
62
|
+
);
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export const ExampleRight = (args) => {
|
|
66
|
+
return (
|
|
67
|
+
<>
|
|
68
|
+
<Float {...args}>
|
|
69
|
+
<img src="https://placehold.jp/400x300.jpg" alt="" />
|
|
70
|
+
</Float>
|
|
71
|
+
<p>{content}</p>
|
|
72
|
+
</>
|
|
73
|
+
);
|
|
74
|
+
};
|
|
75
|
+
ExampleRight.storyName = 'Example : Right';
|
|
76
|
+
ExampleRight.args = {
|
|
77
|
+
position: 'right',
|
|
78
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
export const Frame = ({ ratio, switchRatio, style, ...props }) => {
|
|
4
|
+
style = {
|
|
5
|
+
...style,
|
|
6
|
+
'--unitone--ratio': !!ratio ? ratio : undefined,
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
return (
|
|
10
|
+
<div
|
|
11
|
+
data-unitone-layout={['frame', true === switchRatio ? `-switch` : undefined]
|
|
12
|
+
.filter(Boolean)
|
|
13
|
+
.join(' ')}
|
|
14
|
+
style={style}
|
|
15
|
+
>
|
|
16
|
+
{props.children}
|
|
17
|
+
</div>
|
|
18
|
+
);
|
|
19
|
+
};
|