index.tsx 893 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import React from 'react';
  2. import Icon from '../Icon';
  3. import Typography from '../Typography';
  4. import { Container } from './styled';
  5. import { Separator } from '../../global/otherStyled';
  6. import data from './data';
  7. type Props = {
  8. onClick: (state: string) => void;
  9. navbarState: string;
  10. children: React.ReactNode;
  11. displayMode: string;
  12. fileName: string;
  13. };
  14. const Navbar: React.FC<Props> = ({
  15. onClick,
  16. navbarState,
  17. children,
  18. displayMode,
  19. fileName,
  20. }: Props) => (
  21. <Container isHidden={displayMode === 'full'}>
  22. <Typography variant="title">{fileName}</Typography>
  23. <Separator />
  24. {data.btnGroup.map(ele => (
  25. <Icon
  26. key={ele.key}
  27. glyph={ele.content}
  28. isActive={navbarState === ele.content}
  29. onClick={(): void => {
  30. onClick(ele.content);
  31. }}
  32. />
  33. ))}
  34. {children}
  35. </Container>
  36. );
  37. export default Navbar;