index.tsx 711 B

12345678910111213141516171819202122232425262728293031323334353637
  1. import React from 'react';
  2. import Icon from '../Icon';
  3. import { ToggleButton } from './styled';
  4. type Props = {
  5. displayMode: string;
  6. toggleDisplayMode: (state: string) => void;
  7. };
  8. const FullScreenButton: React.FC<Props> = ({
  9. displayMode,
  10. toggleDisplayMode,
  11. }: Props) => {
  12. return (
  13. <ToggleButton>
  14. {displayMode === 'normal' ? (
  15. <Icon
  16. glyph="tool-close"
  17. onClick={(): void => {
  18. toggleDisplayMode('full');
  19. }}
  20. />
  21. ) : (
  22. <Icon
  23. glyph="tool-open"
  24. onClick={(): void => {
  25. toggleDisplayMode('normal');
  26. }}
  27. />
  28. )}
  29. </ToggleButton>
  30. );
  31. };
  32. export default FullScreenButton;