url-info.tsx 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import React from "react";
  2. import styled from "styled-components";
  3. import { Flex } from "reflexbox/styled-components";
  4. import { NextPage } from "next";
  5. import BodyWrapper from "../components/BodyWrapper";
  6. import Footer from "../components/Footer";
  7. import Text from "../components/Text";
  8. interface Props {
  9. linkTarget?: string;
  10. }
  11. const UrlInfoPage: NextPage<Props> = ({ linkTarget }) => {
  12. return (
  13. <BodyWrapper>
  14. {!linkTarget ? (
  15. <Text as="h2" my={4} fontWeight={300}>
  16. 404 | Link could not be found.
  17. </Text>
  18. ) : (
  19. <>
  20. <Flex flex="1 1 100%" flexDirection="column" alignItems="center">
  21. <Text as="h2" my={3} fontWeight={300}>
  22. Target:
  23. </Text>
  24. <Text as="h4" fontWeight={700}>
  25. {linkTarget}
  26. </Text>
  27. </Flex>
  28. <Footer />
  29. </>
  30. )}
  31. </BodyWrapper>
  32. );
  33. };
  34. UrlInfoPage.getInitialProps = async ctx => {
  35. return { linkTarget: (ctx?.req as any)?.linkTarget };
  36. };
  37. export default UrlInfoPage;