feat: dark/light theming with emotion
This commit is contained in:
27
src/components/Icon/Icon.js
Normal file
27
src/components/Icon/Icon.js
Normal 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;
|
||||
2
src/components/Icon/index.js
Normal file
2
src/components/Icon/index.js
Normal file
@@ -0,0 +1,2 @@
|
||||
import Icon from "./Icon";
|
||||
export default Icon;
|
||||
@@ -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);
|
||||
|
||||
@@ -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>
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user