index.tsx 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. import React from 'react';
  2. import { useTranslation } from 'react-i18next';
  3. import { OptionPropsType } from '../../constants/type';
  4. // import Icon from '../Icon';
  5. // import Button from '../Button';
  6. // import Typography from '../Typography';
  7. import SliderWithTitle from '../SliderWithTitle';
  8. import ColorSelector from '../../containers/ColorSelector';
  9. import {
  10. Wrapper,
  11. // Group,
  12. // Item,
  13. } from '../../global/toolStyled';
  14. const FreehandOption: React.SFC<OptionPropsType> = ({
  15. // type,
  16. color,
  17. opacity,
  18. width,
  19. setDataState = (): void => {
  20. // do nothing
  21. },
  22. }: OptionPropsType) => {
  23. const { t } = useTranslation('sidebar');
  24. return (
  25. <>
  26. {/* <Wrapper>
  27. <Typography variant="subtitle" style={{ marginTop: '4px' }} align="left">
  28. {t('style')}
  29. </Typography>
  30. <Group>
  31. <Item
  32. size="small"
  33. selected={type === 'pen'}
  34. onClick={(): void => { setDataState({ type: 'pen' }); }}
  35. >
  36. <Icon glyph="freehand" />
  37. </Item>
  38. <Item size="small">
  39. <Icon glyph="eraser" />
  40. </Item>
  41. <Item size="small">
  42. <Icon glyph="redo" />
  43. </Item>
  44. <Item size="small">
  45. <Icon glyph="undo" />
  46. </Item>
  47. </Group>
  48. </Wrapper> */}
  49. <Wrapper>
  50. <ColorSelector
  51. title={t('color')}
  52. selectedColor={color}
  53. onClick={(selected: string): void => { setDataState({ color: selected }); }}
  54. />
  55. </Wrapper>
  56. <Wrapper>
  57. <SliderWithTitle
  58. title={t('opacity')}
  59. value={opacity}
  60. tips={`${opacity}%`}
  61. onSlide={(val: number): void => { setDataState({ opacity: val }); }}
  62. />
  63. </Wrapper>
  64. <Wrapper>
  65. <SliderWithTitle
  66. title={t('brushSize')}
  67. value={width}
  68. tips={`${width} pt`}
  69. onSlide={(val: number): void => { setDataState({ width: val }); }}
  70. maximum={40}
  71. />
  72. </Wrapper>
  73. {/* <Wrapper>
  74. <Group style={{ marginTop: '20px', paddingRight: '40px' }}>
  75. <Button
  76. appearance="danger-hollow"
  77. shouldFitContainer
  78. >
  79. <Icon glyph="clear" style={{ marginRight: '5px' }} />
  80. {t('clear')}
  81. </Button>
  82. </Group>
  83. </Wrapper> */}
  84. </>
  85. );
  86. };
  87. export default FreehandOption;