Sidebar.tsx 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import React from 'react';
  2. import Button from '../components/Button';
  3. import Typography from '../components/Typography';
  4. import Icon from '../components/Icon';
  5. import CreateForm from './CreateForm';
  6. import MarkupTools from './MarkupTools';
  7. import Watermark from './Watermark';
  8. import useActions from '../actions';
  9. import useStore from '../store';
  10. import { BtnWrapper } from '../global/toolStyled';
  11. import { SidebarWrapper } from '../global/otherStyled';
  12. const Sidebar: React.FunctionComponent = () => {
  13. const [{ sidebarState, displayMode }, dispatch] = useStore();
  14. const { setSidebar } = useActions(dispatch);
  15. const onClick = (state: string): void => {
  16. if (state === sidebarState) {
  17. setSidebar('');
  18. } else {
  19. setSidebar(state);
  20. }
  21. };
  22. return (
  23. <SidebarWrapper isHidden={displayMode === 'full'}>
  24. <Typography light style={{ marginLeft: '30px', marginTop: '46px' }}>Main Menu</Typography>
  25. <MarkupTools />
  26. <CreateForm />
  27. <BtnWrapper>
  28. <Button shouldFitContainer align="left" onClick={(): void => { onClick('add-image'); }}>
  29. <Icon glyph="add-image" style={{ marginRight: '10px' }} />
  30. Add Image
  31. </Button>
  32. </BtnWrapper>
  33. <Watermark />
  34. </SidebarWrapper>
  35. );
  36. };
  37. export default Sidebar;