index.tsx 2.4 KB

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