tldraw/components/panel.tsx

132 lines
2.3 KiB
TypeScript
Raw Normal View History

2021-05-28 20:30:27 +00:00
import styled from 'styles'
2021-05-17 10:01:11 +00:00
2021-05-28 20:30:27 +00:00
export const Root = styled('div', {
position: 'relative',
backgroundColor: '$panel',
borderRadius: '4px',
overflow: 'hidden',
pointerEvents: 'all',
userSelect: 'none',
2021-05-17 10:01:11 +00:00
zIndex: 200,
2021-05-30 13:49:33 +00:00
border: '1px solid $panel',
boxShadow: '0px 2px 4px rgba(0,0,0,.2)',
2021-05-17 10:01:11 +00:00
variants: {
bp: {
mobile: {},
small: {},
},
variant: {
code: {},
},
2021-05-17 21:27:18 +00:00
isOpen: {
true: {},
2021-05-17 21:27:18 +00:00
false: {
2021-05-30 13:49:33 +00:00
padding: 2,
height: 38,
width: 38,
2021-05-17 21:27:18 +00:00
},
2021-05-17 10:01:11 +00:00
},
},
compoundVariants: [
{
isOpen: true,
variant: 'code',
css: {
position: 'absolute',
top: 8,
left: 8,
right: 8,
bottom: 48,
2021-06-23 22:32:21 +00:00
maxWidth: 680,
zIndex: 1000,
},
},
{
isOpen: true,
variant: 'code',
bp: 'small',
css: {
position: 'absolute',
top: 8,
left: 8,
right: 8,
bottom: 128,
maxWidth: 720,
zIndex: 1000,
},
},
],
2021-05-17 10:01:11 +00:00
})
2021-05-28 20:30:27 +00:00
export const Layout = styled('div', {
display: 'grid',
gridTemplateColumns: '1fr',
gridTemplateRows: 'auto 1fr',
gridAutoRows: '28px',
height: '100%',
width: 'auto',
minWidth: '100%',
2021-05-17 10:01:11 +00:00
maxWidth: 560,
2021-05-28 20:30:27 +00:00
overflow: 'hidden',
userSelect: 'none',
pointerEvents: 'all',
2021-05-17 10:01:11 +00:00
})
2021-05-28 20:30:27 +00:00
export const Header = styled('div', {
pointerEvents: 'all',
display: 'flex',
width: '100%',
alignItems: 'center',
justifyContent: 'space-between',
2021-05-30 13:49:33 +00:00
padding: 2,
2021-05-28 20:30:27 +00:00
position: 'relative',
2021-05-17 10:01:11 +00:00
2021-05-28 20:30:27 +00:00
'& h3': {
position: 'absolute',
2021-05-27 17:59:40 +00:00
top: 0,
left: 0,
2021-05-28 20:30:27 +00:00
width: '100%',
height: '100%',
textAlign: 'center',
2021-05-27 17:59:40 +00:00
padding: 0,
margin: 0,
2021-05-28 20:30:27 +00:00
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
fontSize: '13px',
pointerEvents: 'none',
userSelect: 'none',
},
variants: {
side: {
left: {
flexDirection: 'row',
},
right: {
flexDirection: 'row-reverse',
},
},
2021-05-17 10:01:11 +00:00
},
})
2021-05-28 20:30:27 +00:00
export const ButtonsGroup = styled('div', {
display: 'flex',
2021-05-17 10:01:11 +00:00
})
2021-05-28 20:30:27 +00:00
export const Content = styled('div', {
position: 'relative',
pointerEvents: 'all',
overflowY: 'scroll',
2021-05-17 10:01:11 +00:00
})
2021-05-28 20:30:27 +00:00
export const Footer = styled('div', {
overflowX: 'scroll',
color: '$text',
font: '$debug',
padding: '0 12px',
display: 'flex',
alignItems: 'center',
2021-05-17 10:01:11 +00:00
})