forked from components-ai/css.gui
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbackgrounds.tsx
More file actions
109 lines (105 loc) · 2.85 KB
/
backgrounds.tsx
File metadata and controls
109 lines (105 loc) · 2.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
import { useState } from 'react'
import Link from 'next/link'
import { Editor, Inputs, styled, codegen } from '@compai/css-gui'
import { defaultTheme } from '../../data/default-theme'
const initialStyles = {
// Font
fontSize: {
value: 2,
unit: 'rem',
},
letterSpacing: 'normal',
lineHeight: {
value: 1.5,
unit: 'number',
},
fontFamily: 'Space Mono',
background: [
{
image: {
name: 'url',
arguments: 'https://source.unsplash.com/random',
},
position: {
x: 'center',
y: 'center',
},
repeat: ['no-repeat'],
size: [{ value: 100, unit: '%' }],
attachment: 'fixed',
origin: 'border-box',
clip: 'border-box',
},
],
padding: {
top: {
value: 128,
unit: 'px',
},
},
}
export default function TextDecoration() {
const [styles, setStyles] = useState<any>(initialStyles)
return (
<>
<div
sx={{
display: 'flex',
py: [2, 3, 4],
borderTopWidth: 'thin',
}}
>
<div sx={{ px: [2, 3, 4] }}>
<Editor styles={styles} onChange={setStyles} theme={defaultTheme}>
<section sx={{ display: 'grid', gap: '.5rem', width: '320px' }}>
<h3 sx={{ mt: 4, mb: 0 }}>Backgrounds</h3>
<Inputs.Background />
<Inputs.BackgroundBlendMode />
<h3 sx={{ mt: 4, mb: 0 }}>Typography</h3>
<Inputs.FontFamily />
<Inputs.FontSize />
<Inputs.LineHeight />
<Inputs.LetterSpacing />
<h3 sx={{ mt: 4, mb: 0 }}>Space</h3>
<Inputs.Padding />
<Inputs.Margin />
</section>
</Editor>
</div>
<div sx={{ flexGrow: 1, padding: 5 }}>
<styled.p styles={styles}>
“The parameters comprise sequences which are theoretically infinite
but limits are, of course, set to them in practice. There is an
upward limit to size and certainly a downward one... Within these
sequences there are reasonable bounds; extremes set by technical and
functional experience”
<br /> <br />
<em>
In{' '}
<Link
href="https://www.lars-mueller-publishers.com/designing-programmes-0"
passHref={true}
>
<a style={{ color: styles.color }}>Designing Programmes</a>
</Link>{' '}
by Karl Gerstner
</em>
</styled.p>
</div>
</div>
<div>
<pre
sx={{
p: [2, 3, 4],
borderTop: 'thin solid',
borderColor: 'border',
width: '100%',
fontSize: 3,
}}
>
{codegen.css(styles)}
</pre>
</div>
</>
)
}