tldraw/components/status-bar.tsx

58 lines
1.1 KiB
TypeScript
Raw Normal View History

import { useStateDesigner } from '@state-designer/react'
import state from 'state'
import styled from 'styles'
2021-05-09 13:04:42 +00:00
2021-06-21 21:35:28 +00:00
export default function StatusBar(): JSX.Element {
2021-05-09 13:04:42 +00:00
const local = useStateDesigner(state)
2021-06-11 22:10:17 +00:00
const active = local.active.slice(1).map((s) => {
const states = s.split('.')
return states[states.length - 1]
})
2021-05-09 13:04:42 +00:00
const log = local.log[0]
return (
<StatusBarContainer
size={{
'@sm': 'small',
}}
>
2021-06-11 22:10:17 +00:00
<Section>
{active.join(' | ')} | {log}
</Section>
2021-05-09 13:04:42 +00:00
</StatusBarContainer>
)
}
const StatusBarContainer = styled('div', {
position: 'absolute',
2021-05-09 13:04:42 +00:00
bottom: 0,
left: 0,
width: '100%',
zIndex: 300,
2021-05-09 13:04:42 +00:00
height: 40,
userSelect: 'none',
borderTop: '1px solid black',
gridArea: 'status',
display: 'grid',
gridTemplateColumns: 'auto 1fr auto',
alignItems: 'center',
backgroundColor: 'white',
2021-05-09 13:04:42 +00:00
gap: 8,
fontSize: '$0',
padding: '0 16px',
variants: {
size: {
small: {
fontSize: '$1',
},
},
},
2021-05-09 13:04:42 +00:00
})
const Section = styled('div', {
whiteSpace: 'nowrap',
overflow: 'hidden',
2021-05-09 13:04:42 +00:00
})