index.tsx 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. import React, { useState } from 'react';
  2. import Button from '../Button';
  3. import Icon from '../Icon';
  4. import Drawer from '../Drawer';
  5. import Typography from '../Typography';
  6. import Tabs from '../Tabs';
  7. import Sliders from '../Sliders';
  8. import Divider from '../Divider';
  9. import ColorSelect from '../ColorSelect';
  10. import TextField from '../TextField';
  11. import { BtnWrapper, ContentWrapper } from './styled';
  12. import { Wrapper, Head, Body, IconWrapper } from '../../global/sidebarStyled';
  13. import { Group, SliderWrapper } from '../../global/toolStyled';
  14. type Props = {
  15. sidebarState: string;
  16. onClick: (state: string) => void;
  17. };
  18. const TextContent = () => {
  19. return (
  20. <>
  21. <ContentWrapper>
  22. <Typography variant="subtitle">Content</Typography>
  23. </ContentWrapper>
  24. <TextField variant="multiline" shouldFitContainer />
  25. </>
  26. );
  27. }
  28. const ImageContent = () => {
  29. return (
  30. <ContentWrapper>
  31. <Icon glyph="add-image" />
  32. <Button appearance="link">Select Image</Button>
  33. </ContentWrapper>
  34. );
  35. }
  36. const Watermark: React.FunctionComponent<Props> = ({
  37. onClick,
  38. }) => {
  39. const [isActive, setActive] = useState(false);
  40. const handleClick = () => {
  41. setActive(!isActive);
  42. onClick(!isActive ? 'watermark' : '');
  43. }
  44. return (
  45. <>
  46. <BtnWrapper>
  47. <Button shouldFitContainer align="left" onClick={handleClick}>
  48. <Icon glyph="watermark" style={{marginRight: '10px'}} />
  49. Watermark
  50. </Button>
  51. </BtnWrapper>
  52. <Drawer open={isActive} anchor="left">
  53. <Wrapper>
  54. <Head>
  55. <IconWrapper>
  56. <Icon glyph="left-back" onClick={handleClick} />
  57. </IconWrapper>
  58. <Typography light>Watermark</Typography>
  59. </Head>
  60. <Body>
  61. <Typography variant="subtitle">Type</Typography>
  62. <Tabs
  63. options={[
  64. {
  65. key: 'text',
  66. content: 'Text',
  67. child: <TextContent />,
  68. },
  69. {
  70. key: 'image',
  71. content: 'Image',
  72. child: <ImageContent />,
  73. }
  74. ]}
  75. />
  76. <Divider orientation="horizontal" style={{ margin: '20px 0' }} />
  77. <ColorSelect />
  78. <Typography variant="subtitle">Opacity</Typography>
  79. <Group>
  80. <SliderWrapper>
  81. <Sliders />
  82. </SliderWrapper>
  83. 40%
  84. </Group>
  85. <Divider orientation="horizontal" style={{ margin: '20px 0' }} />
  86. <Group>
  87. <Typography variant="subtitle">Page Range</Typography>
  88. <Button appearance="primary-hollow" style={{width: '50%'}}>All Pages</Button>
  89. </Group>
  90. </Body>
  91. </Wrapper>
  92. </Drawer>
  93. </>
  94. );
  95. };
  96. export default Watermark;