You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

status-bar.tsx 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. import { useStateDesigner } from '@state-designer/react'
  2. import state from 'state'
  3. import styled from 'styles'
  4. const size: any = { '@sm': 'small' }
  5. export default function StatusBar(): JSX.Element {
  6. const local = useStateDesigner(state)
  7. const shapesInView = state.values.shapesToRender.length
  8. const active = local.active
  9. .slice(1)
  10. .map((s) => {
  11. const states = s.split('.')
  12. return states[states.length - 1]
  13. })
  14. .join(' | ')
  15. const log = local.log[0]
  16. if (process.env.NODE_ENV !== 'development') return null
  17. return (
  18. <StatusBarContainer size={size}>
  19. <Section>
  20. {active} - {log}
  21. </Section>
  22. <Section>{shapesInView || '0'} Shapes</Section>
  23. </StatusBarContainer>
  24. )
  25. }
  26. const StatusBarContainer = styled('div', {
  27. height: 40,
  28. userSelect: 'none',
  29. borderTop: '1px solid $border',
  30. gridArea: 'status',
  31. display: 'flex',
  32. color: '$text',
  33. justifyContent: 'space-between',
  34. alignItems: 'center',
  35. backgroundColor: '$panel',
  36. gap: 8,
  37. fontSize: '$0',
  38. padding: '0 16px',
  39. variants: {
  40. size: {
  41. small: {
  42. fontSize: '$1',
  43. },
  44. },
  45. },
  46. })
  47. const Section = styled('div', {
  48. whiteSpace: 'nowrap',
  49. overflow: 'hidden',
  50. })