-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add background color prop to footer component (#136)
Allow to customize footer background color via prop
- Loading branch information
Showing
3 changed files
with
86 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,13 @@ | ||
import * as React from "react"; | ||
import { deepOrange } from "@material-ui/core/colors"; | ||
import { Footer } from "./Footer"; | ||
|
||
export default { | ||
title: "Footer", | ||
}; | ||
|
||
export const Default: React.FC = () => <Footer />; | ||
|
||
export const DeepOrange: React.FC = () => ( | ||
<Footer backgroundcolor={deepOrange[500]} /> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,92 +1,101 @@ | ||
import * as React from "react"; | ||
import Grid from "@material-ui/core/Grid"; | ||
import { StylesProvider } from "@material-ui/core/styles"; | ||
import { StylesProvider, useTheme } from "@material-ui/core/styles"; | ||
import { | ||
BaseFooter, | ||
FooterTitle, | ||
FooterElement, | ||
Divider, | ||
} from "./Footer.styles"; | ||
|
||
export const Footer: React.FC = () => ( | ||
<StylesProvider injectFirst> | ||
<BaseFooter> | ||
<Grid container justify="center" alignItems="center"> | ||
<Grid item> | ||
<Grid container direction="column" spacing={2}> | ||
<Grid item> | ||
<FooterTitle>Categories</FooterTitle> | ||
</Grid> | ||
<Grid item> | ||
<Grid container spacing={6}> | ||
<Grid item> | ||
<Grid container direction="column"> | ||
<Grid item> | ||
<FooterElement>Electronics</FooterElement> | ||
</Grid> | ||
<Grid item> | ||
<FooterElement>Tablets</FooterElement> | ||
</Grid> | ||
<Grid item> | ||
<FooterElement>Displays</FooterElement> | ||
export interface FooterProps { | ||
backgroundcolor?: string | undefined; | ||
} | ||
export const Footer: React.FC<FooterProps> = ({ | ||
backgroundcolor, | ||
}: FooterProps) => { | ||
const theme = useTheme(); | ||
const backgroundColor = backgroundcolor || theme.palette.primary.main; | ||
return ( | ||
<StylesProvider injectFirst> | ||
<BaseFooter backgroundcolor={backgroundColor}> | ||
<Grid container justify="center" alignItems="center"> | ||
<Grid item> | ||
<Grid container direction="column" spacing={2}> | ||
<Grid item> | ||
<FooterTitle>Categories</FooterTitle> | ||
</Grid> | ||
<Grid item> | ||
<Grid container spacing={6}> | ||
<Grid item> | ||
<Grid container direction="column"> | ||
<Grid item> | ||
<FooterElement>Electronics</FooterElement> | ||
</Grid> | ||
<Grid item> | ||
<FooterElement>Tablets</FooterElement> | ||
</Grid> | ||
<Grid item> | ||
<FooterElement>Displays</FooterElement> | ||
</Grid> | ||
</Grid> | ||
</Grid> | ||
</Grid> | ||
<Grid item> | ||
<Grid container direction="column"> | ||
<Grid item> | ||
<FooterElement>Games</FooterElement> | ||
</Grid> | ||
<Grid item> | ||
<FooterElement>Hardware</FooterElement> | ||
</Grid> | ||
<Grid item> | ||
<FooterElement>Software</FooterElement> | ||
<Grid item> | ||
<Grid container direction="column"> | ||
<Grid item> | ||
<FooterElement>Games</FooterElement> | ||
</Grid> | ||
<Grid item> | ||
<FooterElement>Hardware</FooterElement> | ||
</Grid> | ||
<Grid item> | ||
<FooterElement>Software</FooterElement> | ||
</Grid> | ||
</Grid> | ||
</Grid> | ||
</Grid> | ||
</Grid> | ||
</Grid> | ||
<Grid item> | ||
<Divider /> | ||
</Grid> | ||
<Grid item> | ||
<Grid container spacing={5}> | ||
<Grid item> | ||
<FooterTitle>Company</FooterTitle> | ||
</Grid> | ||
<Grid item> | ||
<FooterTitle>Other Links</FooterTitle> | ||
</Grid> | ||
<Grid item> | ||
<Divider /> | ||
</Grid> | ||
</Grid> | ||
<Grid item> | ||
<Grid container spacing={10}> | ||
<Grid item> | ||
<Grid container direction="column"> | ||
<Grid item> | ||
<FooterElement>About</FooterElement> | ||
</Grid> | ||
<Grid item> | ||
<FooterElement>Jobs</FooterElement> | ||
</Grid> | ||
<Grid item> | ||
<Grid container spacing={5}> | ||
<Grid item> | ||
<FooterTitle>Company</FooterTitle> | ||
</Grid> | ||
<Grid item> | ||
<FooterTitle>Other Links</FooterTitle> | ||
</Grid> | ||
</Grid> | ||
<Grid item> | ||
<Grid container direction="column"> | ||
<Grid item> | ||
<FooterElement>Help</FooterElement> | ||
</Grid> | ||
<Grid item> | ||
<Grid container spacing={10}> | ||
<Grid item> | ||
<Grid container direction="column"> | ||
<Grid item> | ||
<FooterElement>About</FooterElement> | ||
</Grid> | ||
<Grid item> | ||
<FooterElement>Jobs</FooterElement> | ||
</Grid> | ||
</Grid> | ||
<Grid item> | ||
<FooterElement>F.A.Q.</FooterElement> | ||
</Grid> | ||
<Grid item> | ||
<Grid container direction="column"> | ||
<Grid item> | ||
<FooterElement>Help</FooterElement> | ||
</Grid> | ||
<Grid item> | ||
<FooterElement>F.A.Q.</FooterElement> | ||
</Grid> | ||
</Grid> | ||
</Grid> | ||
</Grid> | ||
</Grid> | ||
</Grid> | ||
</Grid> | ||
</Grid> | ||
</Grid> | ||
</BaseFooter> | ||
</StylesProvider> | ||
); | ||
</BaseFooter> | ||
</StylesProvider> | ||
); | ||
}; |
3061f99
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to following URLs: