From 0f129d62f554f1b36bbd3dd2ac01159776544954 Mon Sep 17 00:00:00 2001 From: Alison Joseph Date: Wed, 17 Jul 2019 16:57:33 -0500 Subject: [PATCH] feat: refactor Footer to css modules with correct styling --- .../gatsby-theme-carbon/components/Footer.js | 14 +-- .../src/components/{ => Footer}/Footer.js | 107 +++--------------- .../src/components/Footer/Footer.module.scss | 88 ++++++++++++++ .../src/components/Footer/index.js | 3 + 4 files changed, 116 insertions(+), 96 deletions(-) rename packages/gatsby-theme-carbon/src/components/{ => Footer}/Footer.js (67%) create mode 100644 packages/gatsby-theme-carbon/src/components/Footer/Footer.module.scss create mode 100644 packages/gatsby-theme-carbon/src/components/Footer/index.js diff --git a/packages/example/src/gatsby-theme-carbon/components/Footer.js b/packages/example/src/gatsby-theme-carbon/components/Footer.js index 5d3f20a8e..100a047ac 100644 --- a/packages/example/src/gatsby-theme-carbon/components/Footer.js +++ b/packages/example/src/gatsby-theme-carbon/components/Footer.js @@ -4,18 +4,18 @@ import Footer from 'gatsby-theme-carbon/src/components/Footer'; const Content = () => ( <>

- By importing the Footer component from gatsby-theme-carbon, - we can supply our own props. + By importing the Footer component from + gatsby-theme-carbon, we can supply our own props.

-

The default export from a shadowed component will replace that component in the theme.

-
- - More about component shadowing - +

+ + More about component shadowing + +

); diff --git a/packages/gatsby-theme-carbon/src/components/Footer.js b/packages/gatsby-theme-carbon/src/components/Footer/Footer.js similarity index 67% rename from packages/gatsby-theme-carbon/src/components/Footer.js rename to packages/gatsby-theme-carbon/src/components/Footer/Footer.js index 6ff1363bb..6ca2a5820 100644 --- a/packages/gatsby-theme-carbon/src/components/Footer.js +++ b/packages/gatsby-theme-carbon/src/components/Footer/Footer.js @@ -1,95 +1,19 @@ import React from 'react'; import PropTypes from 'prop-types'; -import { Row, Grid, Column } from './Grid'; -import mq from '../util/media-queries'; - -const footerStyles = () => ({ - width: '100%', - display: 'flex', - margin: 0, - color: '#bebebe', - backgroundColor: '#000', - overflowX: 'hidden', -}); - -const gridStyles = () => ({ - margin: 0, - display: 'flex', - justifyContent: 'space-between', - flexDirection: 'column', - padding: '1.5rem 0 2rem 0', - paddingLeft: '1rem', - width: '100%', - maxWidth: '99rem !important', -}); - -const listStyles = ({ colors, typeStyles }) => ({ - padding: 0, - paddingBottom: '2.5rem', - marginBottom: '1.5rem', - marginRight: '1rem', - ...typeStyles.bodyLong01, - a: { - color: colors.ui02, - textDecoration: 'none', - }, - 'a:hover': { - textDecoration: 'underline', - }, - borderBottom: '1px solid rgb(86, 86, 86)', - [mq.sm]: { - li: { - lineHeight: '18px', - marginBottom: '0.5rem', - }, - }, - [mq.md]: { - borderBottom: 'none', - }, -}); - -const contentStyles = ({ colors, typeStyles }) => ({ - maxWidth: '33ch', - paddingBottom: '1.5rem', - marginBottom: '2.5rem', - color: '#bebebe', - padding: 0, - paddingLeft: '1rem', - ...typeStyles.bodyLong01, - a: { - color: colors.ui02, - }, - [mq.sm]: { - paddingBottom: '3rem', - }, - [mq.md]: { - paddingLeft: 0, - }, - [mq.lg]: { - paddingLeft: '0.5rem', - }, -}); - -const rowStyles = () => ({ - [mq.md]: { - paddingLeft: '1rem', - }, - [mq.lg]: { - paddingLeft: 0, - }, -}); +import { Row, Grid, Column } from '../Grid'; +import { footer, grid, nav, list, logo } from './Footer.module.scss'; const Footer = ({ Content, links, Logo }) => { const { firstCol, secondCol } = links; return ( -