|
| 1 | +import styled, { createGlobalStyle } from 'styled-components'; |
| 2 | +import React, { useState } from 'react'; |
| 3 | +import theme from '../../styles/theme'; |
| 4 | +import Button from '../../../components/Button/Button'; |
| 5 | +import { ComicSansProps } from './Footer.types'; |
| 6 | + |
| 7 | +const { mediaQueryMin } = theme; |
| 8 | +const container = theme.containerWidth; |
| 9 | + |
| 10 | +export const FooterCol = styled.div` |
| 11 | + width: 100%; |
| 12 | + margin: 2.5%; |
| 13 | + // Quick fix for small object having a wrong line-height |
| 14 | + p { |
| 15 | + small { |
| 16 | + line-height: 1em; |
| 17 | + } |
| 18 | + } |
| 19 | + @media screen and (${mediaQueryMin.sm}) { |
| 20 | + width: 45%; |
| 21 | + } |
| 22 | + @media screen and (${mediaQueryMin.md}) { |
| 23 | + width: 20%; |
| 24 | + } |
| 25 | +`; |
| 26 | + |
| 27 | +export const FooterLogo = styled.img` |
| 28 | + transform: translateX(-1.5rem); |
| 29 | + max-width: 40vw; |
| 30 | + height: 100%; |
| 31 | + padding: 1em; |
| 32 | + width: auto; |
| 33 | + @media (${mediaQueryMin.md}) { |
| 34 | + max-width: unset; |
| 35 | + } |
| 36 | + @media (${mediaQueryMin.sm}) { |
| 37 | + transform: translateX(-3rem); |
| 38 | + } |
| 39 | +`; |
| 40 | + |
| 41 | +export const FooterLinkContainer = styled.div` |
| 42 | + margin: 1rem 0; |
| 43 | + font-size: 1.33rem; |
| 44 | + line-height: 1.33em; |
| 45 | +`; |
| 46 | + |
| 47 | +export const FooterLink = styled.a` |
| 48 | + display: block; |
| 49 | + text-decoration: none; |
| 50 | + cursor: pointer; |
| 51 | + color: ${theme.colors.lightgray}; |
| 52 | +`; |
| 53 | + |
| 54 | +export const FooterHeadingContainer = styled.div` |
| 55 | + margin: 2em 0 0.66em 0; |
| 56 | + p { |
| 57 | + margin-bottom: 0; |
| 58 | + } |
| 59 | + @media (${mediaQueryMin.sm}) { |
| 60 | + height: 4.66rem; |
| 61 | + display: flex; |
| 62 | + align-items: end; |
| 63 | + } |
| 64 | +`; |
| 65 | + |
| 66 | +export const FooterButton = styled(Button)` |
| 67 | + margin-top: 0; |
| 68 | + font-size: 0.9rem !important; |
| 69 | + padding: 0.5em 2rem; |
| 70 | +`; |
| 71 | + |
| 72 | +export const FooterSpacer = styled.div` |
| 73 | + height: 3.4rem; |
| 74 | +`; |
| 75 | + |
| 76 | +export const FooterContainer = styled.section` |
| 77 | + width: 100%; |
| 78 | + display: flex; |
| 79 | + flex-direction: column; |
| 80 | + flex-wrap: wrap; |
| 81 | + padding: 3em ${container.xs} 1em ${container.xs}; |
| 82 | + @media screen and (${mediaQueryMin.sm}) { |
| 83 | + padding: 3em ${container.sm} 3em ${container.sm}; |
| 84 | + flex-direction: row; |
| 85 | + } |
| 86 | + @media screen and (${mediaQueryMin.md}) { |
| 87 | + padding: 3em ${container.md} 0 ${container.md}; |
| 88 | + } |
| 89 | + @media screen and (${mediaQueryMin.lg}) { |
| 90 | + padding: 3em ${container.lg} 0 ${container.lg}; |
| 91 | + } |
| 92 | + @media screen and (${mediaQueryMin.xl}) { |
| 93 | + padding: 3em ${container.xl} 0 ${container.xl}; |
| 94 | + } |
| 95 | + background: ${theme.colors.secondary}; |
| 96 | +`; |
| 97 | + |
| 98 | +export const Copyright = styled(FooterContainer)` |
| 99 | + justify-content: center; |
| 100 | + flex-direction: column !important; |
| 101 | + text-align: center; |
| 102 | +
|
| 103 | + * { |
| 104 | + } |
| 105 | + hr { |
| 106 | + margin: 0; |
| 107 | + opacity: 0.75; |
| 108 | + } |
| 109 | +
|
| 110 | + p { |
| 111 | + padding-top: 1em; |
| 112 | + opacity: 0.8; |
| 113 | + } |
| 114 | +`; |
| 115 | + |
| 116 | +const ComicSansText = styled.span` |
| 117 | + cursor: pointer; |
| 118 | +`; |
| 119 | +const ComicSansCSS = createGlobalStyle` |
| 120 | + html * { |
| 121 | + font-family: "Comic Sans MS" !important; |
| 122 | + } |
| 123 | +`; |
| 124 | + |
| 125 | +export const ComicSans: React.FC<ComicSansProps> = ({ children }) => { |
| 126 | + const [showComicSans, setShowComicSans] = useState(false); |
| 127 | + const switchComicSans = () => setShowComicSans(!showComicSans); |
| 128 | + |
| 129 | + return ( |
| 130 | + <> |
| 131 | + <ComicSansText onClick={switchComicSans}>{children}</ComicSansText> |
| 132 | + {showComicSans && <ComicSansCSS />} |
| 133 | + </> |
| 134 | + ); |
| 135 | +}; |
0 commit comments