Header.tsx 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. import DynamicLink from "components/DynamicLink";
  2. import React from "react";
  3. import styled from "styled-components";
  4. import backArrow from "assets/back_arrow.png";
  5. import TitleSection from "components/TitleSection";
  6. type Props = {
  7. last_updated: string;
  8. back_link: string;
  9. name: string;
  10. icon: string;
  11. inline_title_items?: React.ReactNodeArray;
  12. };
  13. const Header: React.FunctionComponent<Props> = (props) => {
  14. const { last_updated, back_link, icon, name, inline_title_items } = props;
  15. return (
  16. <HeaderWrapper>
  17. <BackButton to={back_link}>
  18. <BackButtonImg src={backArrow} />
  19. </BackButton>
  20. <Title icon={icon} iconWidth="25px">
  21. {name}
  22. <Flex>{inline_title_items}</Flex>
  23. </Title>
  24. <InfoWrapper>
  25. <InfoText>Last updated {last_updated}</InfoText>
  26. </InfoWrapper>
  27. </HeaderWrapper>
  28. );
  29. };
  30. export default Header;
  31. const HeaderWrapper = styled.div`
  32. position: relative;
  33. margin-bottom: 10px;
  34. `;
  35. const InfoWrapper = styled.div`
  36. display: flex;
  37. align-items: center;
  38. width: auto;
  39. justify-content: space-between;
  40. `;
  41. const InfoText = styled.span`
  42. font-size: 13px;
  43. color: #aaaabb66;
  44. `;
  45. const BackButton = styled(DynamicLink)`
  46. position: absolute;
  47. top: 0px;
  48. right: 0px;
  49. display: flex;
  50. width: 36px;
  51. cursor: pointer;
  52. height: 36px;
  53. align-items: center;
  54. justify-content: center;
  55. border: 1px solid #ffffff55;
  56. border-radius: 100px;
  57. background: #ffffff11;
  58. :hover {
  59. background: #ffffff22;
  60. > img {
  61. opacity: 1;
  62. }
  63. }
  64. `;
  65. const BackButtonImg = styled.img`
  66. width: 16px;
  67. opacity: 0.75;
  68. `;
  69. const Title = styled(TitleSection)`
  70. font-size: 16px;
  71. margin-top: 4px;
  72. `;
  73. const Flex = styled.div`
  74. display: flex;
  75. align-items: center;
  76. margin: 10px 0;
  77. `;