From a9e17764998bfdfcf7f56ac6ace267446d3c4b22 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Tue, 5 Apr 2022 18:08:12 +0100 Subject: [PATCH] More footer links (#1322) * tweaked footer layout * add more links * source links from content file --- content/footer.json | 16 ++++++ src/components/Footer/BuildId.module.css | 3 +- src/components/Footer/Footer.module.css | 51 +++++++++++------ src/components/Footer/Footer.tsx | 47 +++------------- src/components/Footer/Links.module.css | 12 ++++ src/components/Footer/Links.tsx | 55 +++++++++++++++++++ .../Footer/MarketStats/index.module.css | 1 + 7 files changed, 128 insertions(+), 57 deletions(-) create mode 100644 content/footer.json create mode 100644 src/components/Footer/Links.module.css create mode 100644 src/components/Footer/Links.tsx diff --git a/content/footer.json b/content/footer.json new file mode 100644 index 000000000..d4a89329f --- /dev/null +++ b/content/footer.json @@ -0,0 +1,16 @@ +{ + "links": [ + { + "name": "Docs", + "url": "https://docs.oceanprotocol.com" + }, + { + "name": "GitHub", + "url": "https://github.com/oceanprotocol" + }, + { + "name": "Discord", + "url": "https://discord.gg/TnXjkR5" + } + ] +} diff --git a/src/components/Footer/BuildId.module.css b/src/components/Footer/BuildId.module.css index 58fa3b325..86c4cf561 100644 --- a/src/components/Footer/BuildId.module.css +++ b/src/components/Footer/BuildId.module.css @@ -1,6 +1,7 @@ .buildId { - display: inline-block; + display: block; font-size: var(--font-size-mini); margin-bottom: var(--spacer); font-family: var(--font-family-monospace); + text-align: center; } diff --git a/src/components/Footer/Footer.module.css b/src/components/Footer/Footer.module.css index 5eef707b6..91c138751 100644 --- a/src/components/Footer/Footer.module.css +++ b/src/components/Footer/Footer.module.css @@ -1,38 +1,57 @@ -.content { +.footer { padding: var(--spacer) calc(var(--spacer) / 2); margin-left: auto; margin-right: auto; max-width: var(--layout-max-width); + color: var(--brand-grey-light); + font-size: var(--font-size-small); } -.content a, -.content button { +.footer a, +.footer button { color: inherit; } -.content button { +.footer button { text-transform: none; transform: none !important; font-weight: var(--font-weight-normal); } -.content a:hover, -.content a:focus, -.content button:hover, -.content button:focus { +.footer a:hover, +.footer a:focus, +.footer button:hover, +.footer button:focus { color: var(--color-primary); } -.content p { +.copyright > div, +.copyright > div > p { display: inline; } -.copyright div { - display: inline-block; -} - -.footer { - color: var(--brand-grey-light); - font-size: var(--font-size-small); +.copyright, +.grid > div:first-child { text-align: center; } + +.grid { + display: grid; + gap: var(--spacer); +} + +@media (min-width: 40rem) { + .grid { + display: grid; + gap: var(--spacer); + grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); + } + + .grid > div:first-child { + text-align: left; + } + + .copyright { + text-align: right; + } +} diff --git a/src/components/Footer/Footer.tsx b/src/components/Footer/Footer.tsx index 225803a0d..8ca11c95d 100644 --- a/src/components/Footer/Footer.tsx +++ b/src/components/Footer/Footer.tsx @@ -2,56 +2,23 @@ import React, { ReactElement } from 'react' import styles from './Footer.module.css' import Markdown from '@shared/Markdown' import { useSiteMetadata } from '@hooks/useSiteMetadata' -import Link from 'next/link' import MarketStats from './MarketStats' import BuildId from './BuildId' -import { useUserPreferences } from '@context/UserPreferences' -import Button from '@shared/atoms/Button' -import { useGdprMetadata } from '@hooks/useGdprMetadata' +import Links from './Links' export default function Footer(): ReactElement { - const { copyright, appConfig } = useSiteMetadata() - const { setShowPPC } = useUserPreferences() - const { privacyPolicySlug } = useUserPreferences() - - const cookies = useGdprMetadata() - + const { copyright } = useSiteMetadata() const year = new Date().getFullYear() return ( diff --git a/src/components/Footer/Links.module.css b/src/components/Footer/Links.module.css new file mode 100644 index 000000000..b0cd962f5 --- /dev/null +++ b/src/components/Footer/Links.module.css @@ -0,0 +1,12 @@ +.links a { + text-transform: none; + font-family: var(--font-family-base); + font-weight: var(--font-weight-base); +} + +.links svg { + display: inline; + fill: currentColor; + width: 0.6em; + height: 0.6em; +} diff --git a/src/components/Footer/Links.tsx b/src/components/Footer/Links.tsx new file mode 100644 index 000000000..5c9a352c5 --- /dev/null +++ b/src/components/Footer/Links.tsx @@ -0,0 +1,55 @@ +import { useUserPreferences } from '@context/UserPreferences' +import { useGdprMetadata } from '@hooks/useGdprMetadata' +import { useSiteMetadata } from '@hooks/useSiteMetadata' +import Button from '@shared/atoms/Button' +import Link from 'next/link' +import React from 'react' +import content from '../../../content/footer.json' +import External from '@images/external.svg' +import styles from './Links.module.css' + +export default function Links() { + const { appConfig } = useSiteMetadata() + const { setShowPPC, privacyPolicySlug } = useUserPreferences() + const cookies = useGdprMetadata() + + return ( +
+ {content.links.map(({ name, url }) => ( + <> + + {' — '} + + ))} + + + Imprint + + {' — '} + + Terms + + {' — '} + + Privacy + + {appConfig.privacyPreferenceCenter === 'true' && ( + <> + {' — '} + + + )} +
+ ) +} diff --git a/src/components/Footer/MarketStats/index.module.css b/src/components/Footer/MarketStats/index.module.css index e16c8c2b7..34e5d08ac 100644 --- a/src/components/Footer/MarketStats/index.module.css +++ b/src/components/Footer/MarketStats/index.module.css @@ -1,5 +1,6 @@ .stats { margin-bottom: calc(var(--spacer) * 2); + text-align: center; } /* specificity sledgehammer override without !important */