feat: dark/light theming with emotion

This commit is contained in:
Kyle Gill
2019-03-27 21:45:55 -06:00
parent 043acd30cf
commit 49bb678bfa
9 changed files with 140 additions and 25 deletions

View File

@@ -0,0 +1,27 @@
import React from "react";
import styled from "@emotion/styled";
import { Book, Calendar, Circle, User } from "react-feather";
const IconBase = styled.div`
display: flex;
justify-content: center;
align-items: center;
background-color: none;
border-radius: 12px;
padding: 5px;
transition: 0.1s all ease-in-out;
&:hover {
background-color: yellow;
}
`;
const Icon = ({ name }) => (
<IconBase>
{name === "Book" && <Book />}
{name === "Calendar" && <Calendar />}
{name === "Circle" && <Circle />}
{name === "User" && <User />}
</IconBase>
);
export default Icon;

View File

@@ -0,0 +1,2 @@
import Icon from "./Icon";
export default Icon;

View File

@@ -1,14 +1,17 @@
import React from "react";
import { Link } from "react-router-dom";
import styled from "@emotion/styled";
import { compose } from "recompose";
import { withTheme } from "emotion-theming";
import { todayUrl, yearUrl, urls } from "../../utils/date";
import { todayUrl, yearUrl } from "../../utils/date";
import Icon from "../Icon";
import SignOut from "../SignOut";
import { withAuthentication } from "../session";
const Header = styled.div`
background-color: #fafbfc;
background-color: ${props => props.theme.colors.background};
height: 60px;
display: grid;
grid-template-areas: "... nav ...";
@@ -32,7 +35,7 @@ const NavIcons = styled.div`
}
`;
const Navbar = ({ authUser }) => (
const Navbar = ({ authUser, theme }) => (
<Header>
<Nav>
<Logo>Logo</Logo>
@@ -42,6 +45,7 @@ const Navbar = ({ authUser }) => (
<Link to={yearUrl()}>Year</Link>
<Link to={todayUrl()}>Today</Link>
<Link to={"/user"}>Account</Link>
<Icon name="Book" />
<SignOut />
</React.Fragment>
) : (
@@ -56,4 +60,7 @@ const Navbar = ({ authUser }) => (
</Header>
);
export default withAuthentication(Navbar);
export default compose(
withAuthentication,
withTheme
)(Navbar);

View File

@@ -8,13 +8,15 @@ const SeekHeader = styled.header`
flex-direction: row;
justify-content: space-between;
align-items: center;
margin-top: ${SIZES.normal};
`;
const SeekH1 = styled.h1`
display: block;
font-size: ${SIZES.normal};
`;
const SeekArrows = styled.div``;
const SeekHr = styled.hr`
margin: 0;
`;
const Seek = ({ title = "", prev = "", next = "" }) => (
<React.Fragment>
@@ -22,7 +24,7 @@ const Seek = ({ title = "", prev = "", next = "" }) => (
<SeekH1>{title}</SeekH1>
<SeekArrows>asdf</SeekArrows>
</SeekHeader>
<hr />
<SeekHr />
</React.Fragment>
);