@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,123 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import readme from '../README.md';
|
|
3
|
+
|
|
4
|
+
import { Stack } from '../Stack';
|
|
5
|
+
import { Decorator } from '../../decorator/Decorator';
|
|
6
|
+
import { Cluster } from '../../cluster/Cluster';
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
title: 'Layout Primitives/Stack',
|
|
10
|
+
component: Stack,
|
|
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
|
+
negative: {
|
|
24
|
+
control: { type: 'inline-radio' },
|
|
25
|
+
description: 'Using negative gap. Set by `data-unitone-layout` attribute `-negative`.',
|
|
26
|
+
options: [false, true],
|
|
27
|
+
table: { defaultValue: { summary: false } },
|
|
28
|
+
type: { name: 'boolean', required: false },
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
args: {
|
|
32
|
+
gap: 1,
|
|
33
|
+
negative: false,
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const Content = (props) => {
|
|
38
|
+
const content =
|
|
39
|
+
'ja' === props.lang
|
|
40
|
+
? 'あともゴーシュ子たり何に向いていまし。夜中は次がしばらくと落ちて狸から舞台のようで来でおかげをしからちょろちょろゴーシュを合わせていです。どうかまげて子をこどもに出でしです。それりんに狸がこってボック'
|
|
41
|
+
: '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';
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<>
|
|
45
|
+
<p style={{ '--unitone--font-size': -2 }}>{content}</p>
|
|
46
|
+
<p style={{ '--unitone--font-size': -1 }}>{content}</p>
|
|
47
|
+
<p>{content}</p>
|
|
48
|
+
<p style={{ '--unitone--font-size': 1 }}>{content}</p>
|
|
49
|
+
<p style={{ '--unitone--font-size': 2 }}>{content}</p>
|
|
50
|
+
<p style={{ '--unitone--font-size': 3 }}>{content}</p>
|
|
51
|
+
<p style={{ '--unitone--font-size': 4 }}>{content}</p>
|
|
52
|
+
<p style={{ '--unitone--font-size': 5 }}>{content}</p>
|
|
53
|
+
<p style={{ '--unitone--font-size': 6 }}>{content}</p>
|
|
54
|
+
<p style={{ '--unitone--font-size': 7 }}>{content}</p>
|
|
55
|
+
</>
|
|
56
|
+
);
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export const Default = (args) => {
|
|
60
|
+
return (
|
|
61
|
+
<Stack {...args}>
|
|
62
|
+
<Content />
|
|
63
|
+
</Stack>
|
|
64
|
+
);
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export const ExampleJa = (args) => {
|
|
68
|
+
return (
|
|
69
|
+
<Stack {...args}>
|
|
70
|
+
<Content lang="ja" />
|
|
71
|
+
</Stack>
|
|
72
|
+
);
|
|
73
|
+
};
|
|
74
|
+
ExampleJa.storyName = 'Example : Ja';
|
|
75
|
+
|
|
76
|
+
export const ExampleCard = (args) => {
|
|
77
|
+
return (
|
|
78
|
+
<div style={{ maxWidth: '480px' }}>
|
|
79
|
+
<Decorator
|
|
80
|
+
backgroundColor={args.backgroundColor}
|
|
81
|
+
color={args.color}
|
|
82
|
+
padding="1"
|
|
83
|
+
borderRadius="4px"
|
|
84
|
+
>
|
|
85
|
+
<Stack gap={args.gap}>
|
|
86
|
+
<Decorator>
|
|
87
|
+
<Cluster>
|
|
88
|
+
<img
|
|
89
|
+
src="https://ja.gravatar.com/userimage/18715762/ad5c138cf1d8f3ce1bda5218f26b9b4e.jpeg"
|
|
90
|
+
alt=""
|
|
91
|
+
style={{ width: '48px', height: '48px' }}
|
|
92
|
+
/>
|
|
93
|
+
<Stack gap="0">
|
|
94
|
+
<div>
|
|
95
|
+
<b>Takashi Kitajima</b>
|
|
96
|
+
</div>
|
|
97
|
+
<div style={{ '--unitone--font-size': -1 }}>Takashi Kitajima</div>
|
|
98
|
+
</Stack>
|
|
99
|
+
</Cluster>
|
|
100
|
+
</Decorator>
|
|
101
|
+
<div>
|
|
102
|
+
<Stack style={{ '--unitone--font-size': -1 }}>
|
|
103
|
+
<p>
|
|
104
|
+
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor
|
|
105
|
+
incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud
|
|
106
|
+
exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute
|
|
107
|
+
irure dolor in reprehenderit in voluptate velit esse cill
|
|
108
|
+
</p>
|
|
109
|
+
</Stack>
|
|
110
|
+
</div>
|
|
111
|
+
</Stack>
|
|
112
|
+
</Decorator>
|
|
113
|
+
</div>
|
|
114
|
+
);
|
|
115
|
+
};
|
|
116
|
+
ExampleCard.args = {
|
|
117
|
+
color: '#f0f2f6',
|
|
118
|
+
backgroundColor: '#1e293a',
|
|
119
|
+
};
|
|
120
|
+
ExampleCard.storyName = 'Example : Card';
|
|
121
|
+
ExampleCard.argTypes = {
|
|
122
|
+
center: { table: { disable: true } },
|
|
123
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
## Usage
|
|
2
|
+
|
|
3
|
+
```html
|
|
4
|
+
<div data-unitone-layout="switcher">
|
|
5
|
+
<div data-unitone-layout="box" style="--unitone--background-color: #decc00">Lorem ipsum</div>
|
|
6
|
+
<div data-unitone-layout="box" style="--unitone--background-color: #bfb6a8">dolor sit</div>
|
|
7
|
+
<div data-unitone-layout="box" style="--unitone--background-color: #edede6">amet consectetur</div>
|
|
8
|
+
</div>
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
### Customizing gap
|
|
12
|
+
|
|
13
|
+
```html
|
|
14
|
+
<div data-unitone-layout="switcher -gap:1">
|
|
15
|
+
...
|
|
16
|
+
</div>
|
|
17
|
+
```
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
export const Switcher = ({ gap, limit, threshold, style, ...props }) => {
|
|
4
|
+
style = {
|
|
5
|
+
...style,
|
|
6
|
+
'--unitone--threshold': !!threshold ? threshold : undefined,
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
return (
|
|
10
|
+
<div
|
|
11
|
+
data-unitone-layout={['switcher', 'undefined' !== typeof gap ? `-gap:${gap}` : undefined]
|
|
12
|
+
.filter(Boolean)
|
|
13
|
+
.join(' ')}
|
|
14
|
+
style={style}
|
|
15
|
+
>
|
|
16
|
+
{props.children}
|
|
17
|
+
</div>
|
|
18
|
+
);
|
|
19
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
@mixin abstract-switcher() {
|
|
2
|
+
--unitone--gap: var(--unitone--s1);
|
|
3
|
+
--unitone--threshold: var(--unitone--measure);
|
|
4
|
+
|
|
5
|
+
display: flex;
|
|
6
|
+
flex-wrap: wrap;
|
|
7
|
+
gap: var(--unitone--gap);
|
|
8
|
+
|
|
9
|
+
> * {
|
|
10
|
+
flex-grow: 1;
|
|
11
|
+
flex-basis: calc((var(--unitone--threshold) - 100%) * 999);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
@mixin switcher() {
|
|
16
|
+
[data-unitone-layout~="switcher"] {
|
|
17
|
+
@include abstract-switcher();
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import readme from '../README.md';
|
|
3
|
+
|
|
4
|
+
import { Switcher } from '../Switcher';
|
|
5
|
+
import { Decorator } from '../../decorator/Decorator';
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
title: 'Layout Primitives/Switcher',
|
|
9
|
+
component: Switcher,
|
|
10
|
+
parameters: {
|
|
11
|
+
notes: { readme },
|
|
12
|
+
},
|
|
13
|
+
argTypes: {
|
|
14
|
+
gap: {
|
|
15
|
+
control: { type: 'inline-radio' },
|
|
16
|
+
description:
|
|
17
|
+
'Gap. Set by CSS var `--unitone--gap` or `data-unitone-layout` attribute `-gap:x`.',
|
|
18
|
+
options: [-2, -1, 0, 1, 2, 3, 4, 5, 6, 7],
|
|
19
|
+
table: { defaultValue: { summary: 'var(--unitone--s1)' } },
|
|
20
|
+
type: { name: 'number', required: false },
|
|
21
|
+
},
|
|
22
|
+
threshold: {
|
|
23
|
+
control: { type: 'text' },
|
|
24
|
+
description:
|
|
25
|
+
'If the box size is smaller than this value, it switches to one column. Set by CSS var `--unitone--threshold`.',
|
|
26
|
+
table: { defaultValue: { summary: 'var(--unitone--measure)' } },
|
|
27
|
+
type: { name: 'string', required: false },
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
args: {
|
|
31
|
+
gap: 1,
|
|
32
|
+
threshold: 'var(--unitone--measure)',
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export const Default = (args) => {
|
|
37
|
+
return (
|
|
38
|
+
<Switcher {...args}>
|
|
39
|
+
<Decorator backgroundColor="#decc00" padding={1}>
|
|
40
|
+
Lorem ipsum
|
|
41
|
+
</Decorator>
|
|
42
|
+
<Decorator backgroundColor="#bfb6a8" padding={1}>
|
|
43
|
+
dolor sit
|
|
44
|
+
</Decorator>
|
|
45
|
+
<Decorator backgroundColor="#edede6" padding={1}>
|
|
46
|
+
amet consectetur
|
|
47
|
+
</Decorator>
|
|
48
|
+
</Switcher>
|
|
49
|
+
);
|
|
50
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
## Usage
|
|
2
|
+
|
|
3
|
+
```html
|
|
4
|
+
<div data-unitone-layout="text">
|
|
5
|
+
<p>Lorem 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>
|
|
6
|
+
<p>Lorem 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>
|
|
7
|
+
</div>
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
### Centering children
|
|
11
|
+
|
|
12
|
+
```html
|
|
13
|
+
<div data-unitone-layout="text -center">
|
|
14
|
+
...
|
|
15
|
+
</div>
|
|
16
|
+
```
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
export const Text = ({ center, maxWidth, scale, style, ...props }) => {
|
|
4
|
+
style = {
|
|
5
|
+
...style,
|
|
6
|
+
'--unitone--max-width': !!maxWidth ? maxWidth : undefined,
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
return (
|
|
10
|
+
<div
|
|
11
|
+
data-unitone-layout={['text', true === center ? '-center' : undefined]
|
|
12
|
+
.filter(Boolean)
|
|
13
|
+
.join(' ')}
|
|
14
|
+
style={style}
|
|
15
|
+
>
|
|
16
|
+
{props.children}
|
|
17
|
+
</div>
|
|
18
|
+
);
|
|
19
|
+
};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
@mixin abstract-text() {
|
|
2
|
+
--unitone--max-width: var(--unitone--measure);
|
|
3
|
+
|
|
4
|
+
> * {
|
|
5
|
+
--unitone--gap: var(--unitone--s1);
|
|
6
|
+
margin: 0 auto;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
> *:not(:first-child) {
|
|
10
|
+
margin-top: calc(var(--unitone--margin-top, 1) * var(--unitone--gap));
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
> *:not(:last-child) {
|
|
14
|
+
margin-bottom: calc(var(--unitone--margin-bottom, 1) * var(--unitone--gap));
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
> h1 {
|
|
18
|
+
--unitone--font-size: 4;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
> :where(h2, h3, h4, h5, h6) {
|
|
22
|
+
--unitone--margin-bottom: 0;
|
|
23
|
+
|
|
24
|
+
& + :where(h2, h3, h4, h5, h6) {
|
|
25
|
+
--unitone--margin-top: .5;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
> h2 {
|
|
30
|
+
--unitone--font-size: 3;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
> h3 {
|
|
34
|
+
--unitone--font-size: 2;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
> h4 {
|
|
38
|
+
--unitone--font-size: 1;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
> h5 {
|
|
42
|
+
--unitone--font-size: 0;
|
|
43
|
+
|
|
44
|
+
& + * {
|
|
45
|
+
--unitone--margin-top: .5;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
> h6 {
|
|
50
|
+
--unitone--font-size: 0;
|
|
51
|
+
|
|
52
|
+
& + * {
|
|
53
|
+
--unitone--margin-top: .5;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
@mixin text() {
|
|
59
|
+
[data-unitone-layout~="text"] {
|
|
60
|
+
@include abstract-text();
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
:where([data-unitone-layout~="text"] > *) {
|
|
64
|
+
max-width: min(100%, var(--unitone--max-width));
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
:where([data-unitone-layout~="text"][data-unitone-layout~="-center"]) > * {
|
|
68
|
+
width: fit-content;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
[data-unitone-layout~="text"]:lang(ja) {
|
|
72
|
+
font-feature-settings: "palt" 0;
|
|
73
|
+
font-kerning: none;
|
|
74
|
+
|
|
75
|
+
> :where(h1, h2, h3, h4, h5) {
|
|
76
|
+
font-feature-settings: "palt" 1;
|
|
77
|
+
font-kerning: normal;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import readme from '../README.md';
|
|
3
|
+
|
|
4
|
+
import { Text } from '../Text';
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: 'Layout Primitives/Text',
|
|
8
|
+
component: Text,
|
|
9
|
+
parameters: {
|
|
10
|
+
notes: { readme },
|
|
11
|
+
},
|
|
12
|
+
argTypes: {
|
|
13
|
+
center: {
|
|
14
|
+
control: { type: 'inline-radio' },
|
|
15
|
+
description: 'Centering child items. Set by `data-unitone-layout` attribute `-center`.',
|
|
16
|
+
options: [false, true],
|
|
17
|
+
table: { defaultValue: { summary: false } },
|
|
18
|
+
type: { name: 'boolean', required: false },
|
|
19
|
+
},
|
|
20
|
+
maxWidth: {
|
|
21
|
+
control: { type: 'text' },
|
|
22
|
+
description: 'Max width. Set by CSS var `--unitone--max-width`.',
|
|
23
|
+
table: { defaultValue: { summary: 'var(--unitone--measure)' } },
|
|
24
|
+
type: { name: 'string', required: false },
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
args: {
|
|
28
|
+
center: false,
|
|
29
|
+
maxWidth: 'var(--unitone--measure)',
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const Content = (props) => {
|
|
34
|
+
const headingText =
|
|
35
|
+
'ja' === props.lang
|
|
36
|
+
? 'あともゴーシュ子たり何に向いていまし'
|
|
37
|
+
: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit';
|
|
38
|
+
|
|
39
|
+
const bodyText =
|
|
40
|
+
'ja' === props.lang
|
|
41
|
+
? 'あともゴーシュ子たり何に向いていまし。夜中は次がしばらくと落ちて狸から舞台のようで来でおかげをしからちょろちょろゴーシュを合わせていです。どうかまげて子をこどもに出でしです。それりんに狸がこってボック'
|
|
42
|
+
: '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';
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<>
|
|
46
|
+
<h1>{headingText}</h1>
|
|
47
|
+
<p>{bodyText}</p>
|
|
48
|
+
<p style={{ '--unitone--font-size': 2 }}>{bodyText}</p>
|
|
49
|
+
<p>{bodyText}</p>
|
|
50
|
+
<ul>
|
|
51
|
+
<li>{bodyText}</li>
|
|
52
|
+
<li>{bodyText}</li>
|
|
53
|
+
</ul>
|
|
54
|
+
|
|
55
|
+
<h2>{headingText}</h2>
|
|
56
|
+
<h3>{headingText}</h3>
|
|
57
|
+
<h4>{headingText}</h4>
|
|
58
|
+
<h5>{headingText}</h5>
|
|
59
|
+
<h6>{headingText}</h6>
|
|
60
|
+
<p>{bodyText}</p>
|
|
61
|
+
|
|
62
|
+
<h2>{headingText}</h2>
|
|
63
|
+
<p>{bodyText}</p>
|
|
64
|
+
<p>{bodyText}</p>
|
|
65
|
+
|
|
66
|
+
<h3>{headingText}</h3>
|
|
67
|
+
<p>{bodyText}</p>
|
|
68
|
+
<p>{bodyText}</p>
|
|
69
|
+
|
|
70
|
+
<h4>{headingText}</h4>
|
|
71
|
+
<p>{bodyText}</p>
|
|
72
|
+
<p>{bodyText}</p>
|
|
73
|
+
|
|
74
|
+
<h5>{headingText}</h5>
|
|
75
|
+
<p>{bodyText}</p>
|
|
76
|
+
<p>{bodyText}</p>
|
|
77
|
+
|
|
78
|
+
<h6>{headingText}</h6>
|
|
79
|
+
<p>{bodyText}</p>
|
|
80
|
+
<p>{bodyText}</p>
|
|
81
|
+
</>
|
|
82
|
+
);
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
export const Default = (args) => {
|
|
86
|
+
return (
|
|
87
|
+
<Text {...args}>
|
|
88
|
+
<Content />
|
|
89
|
+
</Text>
|
|
90
|
+
);
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
export const ExampleCenter = (args) => {
|
|
94
|
+
return (
|
|
95
|
+
<Text {...args}>
|
|
96
|
+
<Content />
|
|
97
|
+
</Text>
|
|
98
|
+
);
|
|
99
|
+
};
|
|
100
|
+
ExampleCenter.args = {
|
|
101
|
+
center: true,
|
|
102
|
+
};
|
|
103
|
+
ExampleCenter.storyName = 'Example : Center';
|
|
104
|
+
|
|
105
|
+
export const ExampleJa = (args) => {
|
|
106
|
+
return (
|
|
107
|
+
<Text {...args} style={{ '--unitone--half-leading': 0.4 }}>
|
|
108
|
+
<Content lang="ja" />
|
|
109
|
+
</Text>
|
|
110
|
+
);
|
|
111
|
+
};
|
|
112
|
+
ExampleJa.storyName = 'Example : Ja';
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
## Usage
|
|
2
|
+
|
|
3
|
+
```html
|
|
4
|
+
<div data-unitone-layout="with-sidebar">
|
|
5
|
+
<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>
|
|
6
|
+
<ul>
|
|
7
|
+
<li>Lorem</li>
|
|
8
|
+
<li>ipsum</li>
|
|
9
|
+
<li>dolor</li>
|
|
10
|
+
</ul>
|
|
11
|
+
</div>
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
### Left sidebar
|
|
15
|
+
|
|
16
|
+
```html
|
|
17
|
+
<div data-unitone-layout="with-sidebar -sidebar:left">
|
|
18
|
+
...
|
|
19
|
+
</div>
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### Revert
|
|
23
|
+
|
|
24
|
+
```html
|
|
25
|
+
<div data-unitone-layout="with-sidebar -revert">
|
|
26
|
+
...
|
|
27
|
+
</div>
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Customizing align
|
|
31
|
+
|
|
32
|
+
```html
|
|
33
|
+
<ul data-unitone-layout="with-slider -align-items:center">
|
|
34
|
+
...
|
|
35
|
+
</ul>
|
|
36
|
+
```
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
export const WithSidebar = ({
|
|
4
|
+
gap,
|
|
5
|
+
contentMinWidth,
|
|
6
|
+
revert,
|
|
7
|
+
sidebar,
|
|
8
|
+
sidebarWidth,
|
|
9
|
+
alignItems,
|
|
10
|
+
style,
|
|
11
|
+
...props
|
|
12
|
+
}) => {
|
|
13
|
+
style = {
|
|
14
|
+
...style,
|
|
15
|
+
'--unitone--sidebar-width': !!sidebarWidth ? sidebarWidth : undefined,
|
|
16
|
+
'--unitone--content-min-width': !!contentMinWidth ? contentMinWidth : undefined,
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<div
|
|
21
|
+
data-unitone-layout={[
|
|
22
|
+
'with-sidebar',
|
|
23
|
+
true === revert ? '-revert' : undefined,
|
|
24
|
+
'undefined' !== typeof gap ? `-gap:${gap}` : undefined,
|
|
25
|
+
'undefined' !== typeof sidebar ? `-sidebar:${sidebar}` : undefined,
|
|
26
|
+
'undefined' !== typeof alignItems ? `-align-items:${alignItems}` : undefined,
|
|
27
|
+
]
|
|
28
|
+
.filter(Boolean)
|
|
29
|
+
.join(' ')}
|
|
30
|
+
style={style}
|
|
31
|
+
>
|
|
32
|
+
{props.children}
|
|
33
|
+
</div>
|
|
34
|
+
);
|
|
35
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
@mixin _aside() {
|
|
2
|
+
flex-basis: var(--unitone--sidebar-width);
|
|
3
|
+
flex-grow: 1;
|
|
4
|
+
min-width: 1rem;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
@mixin _main() {
|
|
8
|
+
flex-basis: 0;
|
|
9
|
+
flex-grow: 999;
|
|
10
|
+
min-width: min(100%, var(--unitone--content-min-width));
|
|
11
|
+
max-width: min(100%, var(--unitone--content-max-width));
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
@mixin abstract-with-sidebar() {
|
|
15
|
+
--unitone--content-min-width: 50%;
|
|
16
|
+
--unitone--content-max-width: 100%;
|
|
17
|
+
--unitone--gap: var(--unitone--s1);
|
|
18
|
+
--unitone--align-items: flex-start;
|
|
19
|
+
|
|
20
|
+
display: flex;
|
|
21
|
+
flex-wrap: wrap;
|
|
22
|
+
gap: var(--unitone--gap);
|
|
23
|
+
align-items: var(--unitone--align-items);
|
|
24
|
+
|
|
25
|
+
&:not([data-unitone-layout~="-revert"])[data-unitone-layout~="-sidebar\:right"],
|
|
26
|
+
&:not([data-unitone-layout~="-revert"]):not([data-unitone-layout~="-sidebar\:left"]),
|
|
27
|
+
&[data-unitone-layout~="-revert"][data-unitone-layout~="-sidebar\:left"] {
|
|
28
|
+
> :first-child {
|
|
29
|
+
@include _main();
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
> :last-child {
|
|
33
|
+
@include _aside();
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
&:not([data-unitone-layout~="-revert"])[data-unitone-layout~="-sidebar\:left"],
|
|
38
|
+
&[data-unitone-layout~="-revert"][data-unitone-layout~="-sidebar\:right"],
|
|
39
|
+
&[data-unitone-layout~="-revert"]:not([data-unitone-layout~="-sidebar\:left"]) {
|
|
40
|
+
> :first-child {
|
|
41
|
+
@include _aside();
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
> :last-child {
|
|
45
|
+
@include _main();
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
&[data-unitone-layout~="-revert"] {
|
|
50
|
+
flex-direction: row-reverse;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
@mixin with-sidebar() {
|
|
55
|
+
[data-unitone-layout~="with-sidebar"] {
|
|
56
|
+
@include abstract-with-sidebar();
|
|
57
|
+
}
|
|
58
|
+
}
|