CreateForm.tsx 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. import React from 'react';
  2. import Button from '../components/Button';
  3. import Icon from '../components/Icon';
  4. import ExpansionPanel from '../components/ExpansionPanel';
  5. import useActions from '../actions';
  6. import useStore from '../store';
  7. import { BtnWrapper } from '../global/toolStyled';
  8. const CreateForm: React.FunctionComponent = () => {
  9. const [{ sidebarState }, dispatch] = useStore();
  10. const { setSidebar } = useActions(dispatch);
  11. const onClickSidebar = (state: string): void => {
  12. if (state === sidebarState) {
  13. setSidebar('');
  14. } else {
  15. setSidebar(state);
  16. }
  17. };
  18. return (
  19. <ExpansionPanel
  20. label={(
  21. <Button shouldFitContainer align="left" onClick={(): void => { onClickSidebar('create-form'); }}>
  22. <Icon glyph="create-form" style={{ marginRight: '10px' }} />
  23. Create Form
  24. </Button>
  25. )}
  26. isActive={sidebarState === 'create-form'}
  27. >
  28. <BtnWrapper>
  29. <Button shouldFitContainer align="left">
  30. <Icon glyph="text-field" style={{ marginRight: '10px' }} />
  31. Text Field
  32. </Button>
  33. </BtnWrapper>
  34. <BtnWrapper>
  35. <Button shouldFitContainer align="left">
  36. <Icon glyph="checkbox" style={{ marginRight: '10px' }} />
  37. Check box
  38. </Button>
  39. </BtnWrapper>
  40. <BtnWrapper>
  41. <Button shouldFitContainer align="left">
  42. <Icon glyph="radio-button" style={{ marginRight: '10px' }} />
  43. Radio Button
  44. </Button>
  45. </BtnWrapper>
  46. </ExpansionPanel>
  47. );
  48. };
  49. export default CreateForm;