forked from components-ai/css.gui
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSidebar.tsx
More file actions
69 lines (67 loc) · 1.49 KB
/
Sidebar.tsx
File metadata and controls
69 lines (67 loc) · 1.49 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
import { HTMLAttributes } from 'react'
import { Editor } from '@compai/css-gui'
import { ElementEditor } from './ElementEditor'
import { Element } from './types'
type SidebarProps = {
styles: any
onChange: (newStyles: any) => void
element: Element
onElementChange: (newElement: any) => void
}
export const Sidebar = ({
styles,
onChange,
element,
onElementChange,
}: SidebarProps) => {
return (
<section
sx={{
minHeight: '100vh',
height: '100%',
borderLeftWidth: '1px',
borderLeftStyle: 'solid',
borderLeftColor: 'border',
pt: [2, 3],
pb: 4,
overflowY: 'auto',
top: 0,
right: 0,
bottom: 0,
order: [2, 1, 1],
}}
>
<div sx={{ px: 2, pb: 1 }}>
<ElementEditor element={element} onChange={onElementChange} />
</div>
<div
sx={{
mt: 3,
px: 2,
borderTopStyle: 'solid',
borderTopColor: 'border',
borderTopWidth: 'thin',
}}
>
<SectionTitle>Styling</SectionTitle>
<Editor styles={styles} onChange={onChange} showAddProperties />
</div>
</section>
)
}
interface SectionTitleProps extends HTMLAttributes<HTMLHeadingElement> {}
export const SectionTitle = (props: SectionTitleProps) => {
return (
<h3
sx={{
lineHeight: '1.25',
fontWeight: 500,
fontSize: 2,
pt: [2, 3],
pb: 1,
m: 0,
}}
{...props}
/>
)
}