index.tsx 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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 => {
  54. setDataState({ color: selected });
  55. }}
  56. />
  57. </Wrapper>
  58. <Wrapper>
  59. <SliderWithTitle
  60. title={t('opacity')}
  61. value={opacity}
  62. tips={`${opacity}%`}
  63. onSlide={(val: number): void => {
  64. setDataState({ opacity: val });
  65. }}
  66. />
  67. </Wrapper>
  68. <Wrapper>
  69. <SliderWithTitle
  70. title={t('brushSize')}
  71. value={width}
  72. tips={`${width} pt`}
  73. onSlide={(val: number): void => {
  74. setDataState({ width: val });
  75. }}
  76. maximum={40}
  77. />
  78. </Wrapper>
  79. {/* <Wrapper>
  80. <Group style={{ marginTop: '20px', paddingRight: '40px' }}>
  81. <Button
  82. appearance="danger-hollow"
  83. shouldFitContainer
  84. >
  85. <Icon glyph="clear" style={{ marginRight: '5px' }} />
  86. {t('clear')}
  87. </Button>
  88. </Group>
  89. </Wrapper> */}
  90. </>
  91. );
  92. };
  93. export default FreehandOption;