index.tsx 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. import { memo } from 'react'
  2. import Divider from './divider'
  3. import type { ColorPickerProps } from './color-picker'
  4. import ColorPicker from './color-picker'
  5. import FontSizeSelector from './font-size-selector'
  6. import Command from './command'
  7. import type { OperatorProps } from './operator'
  8. import Operator from './operator'
  9. type ToolbarProps = ColorPickerProps & OperatorProps
  10. const Toolbar = ({
  11. theme,
  12. onThemeChange,
  13. onCopy,
  14. onDuplicate,
  15. onDelete,
  16. showAuthor,
  17. onShowAuthorChange,
  18. }: ToolbarProps) => {
  19. return (
  20. <div className='inline-flex items-center p-0.5 bg-white rounded-lg border-[0.5px] border-black/5 shadow-sm'>
  21. <ColorPicker
  22. theme={theme}
  23. onThemeChange={onThemeChange}
  24. />
  25. <Divider />
  26. <FontSizeSelector />
  27. <Divider />
  28. <div className='flex items-center space-x-0.5'>
  29. <Command type='bold' />
  30. <Command type='italic' />
  31. <Command type='strikethrough' />
  32. <Command type='link' />
  33. <Command type='bullet' />
  34. </div>
  35. <Divider />
  36. <Operator
  37. onCopy={onCopy}
  38. onDuplicate={onDuplicate}
  39. onDelete={onDelete}
  40. showAuthor={showAuthor}
  41. onShowAuthorChange={onShowAuthorChange}
  42. />
  43. </div>
  44. )
  45. }
  46. export default memo(Toolbar)