Watermark.tsx 606 B

1234567891011121314151617181920212223242526
  1. import React, { useState } from 'react';
  2. import WatermarkComponent from '../components/Watermark';
  3. import useActions from '../actions';
  4. import useStore from '../store';
  5. const Watermark: React.FunctionComponent = () => {
  6. const [isActive, setActive] = useState(false);
  7. const [, dispatch] = useStore();
  8. const { switchSidebar } = useActions(dispatch);
  9. const handleClick = (): void => {
  10. setActive(!isActive);
  11. switchSidebar(!isActive ? 'watermark' : '');
  12. };
  13. return (
  14. <WatermarkComponent
  15. isActive={isActive}
  16. onClick={handleClick}
  17. />
  18. );
  19. };
  20. export default Watermark;