Skip to content

Commit

Permalink
Setup-styled-components#74; Card styles
Browse files Browse the repository at this point in the history
  • Loading branch information
nickllerandi committed Apr 24, 2019
1 parent 9ebf2b7 commit 2edabfb
Show file tree
Hide file tree
Showing 10 changed files with 56 additions and 22 deletions.
1 change: 1 addition & 0 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"dependencies": {
"axios": "^0.18.0",
"jwt-decode": "^2.2.0",
"polished": "^3.2.0",
"react": "^16.7.0",
"react-dom": "^16.7.0",
"react-redux": "^6.0.0",
Expand Down
16 changes: 9 additions & 7 deletions client/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,15 @@ class App extends Component {
<Router>
<div className="App">
<Navbar/>
<Route exact path="/" component={Homepage}/>
<Route exact path="/register" component={Register}/>
<Route exact path="/login" component={Login}/>
<Route exact path="/ask" component={Ask}/>
<Route exact path="/questions/:id" component={Question}/>
<Route exact path="/users/:id/:name" component={Profile}/>
<Route exact path="/users/:id/:name/edit" component={ProfileEdit}/>
<main>
<Route exact path="/" component={Homepage}/>
<Route exact path="/register" component={Register}/>
<Route exact path="/login" component={Login}/>
<Route exact path="/ask" component={Ask}/>
<Route exact path="/questions/:id" component={Question}/>
<Route exact path="/users/:id/:name" component={Profile}/>
<Route exact path="/users/:id/:name/edit" component={ProfileEdit}/>
</main>
<Footer/>
<GlobalStyle/>
</div>
Expand Down
20 changes: 15 additions & 5 deletions client/src/Global.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,29 @@
import {createGlobalStyle} from 'styled-components'
import {normalize} from 'polished'

const GlobalStyle = createGlobalStyle`
${normalize()}
html {
box-sizing: border-box;
}
*, *:before, *:after {
box-sizing: inherit;
}
body {
margin: 0;
padding: 90px 0 0;
box-sizing: border-box;
font-family: Arial, Helvetica, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
a:link, a:visited {
text-decoration: none;
list-style: none;
color: inherit;
main {
max-width: 1264px;
width: 100%;
height: 100%;
margin: 0 auto;
}
`;

Expand Down
2 changes: 1 addition & 1 deletion client/src/components/homepage/Homepage.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Homepage extends Component {

return (
<div className="Landing">
<Heading>Full Stack Musician</Heading>
<Heading>Recent Questions</Heading>
{name ? <h2>Hi {name}</h2> : null}
<Button>
<Link to="/ask">Ask a Question</Link>
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/layout/Navbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Navbar extends Component {
<Link to="/login">Login</Link>
</li>
<li>
<Link to="/register">Signup</Link>
<Link to="/register">Sign up</Link>
</li>
</ul>
);
Expand Down
11 changes: 7 additions & 4 deletions client/src/components/questions/AllQuestions.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,27 @@
import React, {Component} from "react";
import {Link} from "react-router-dom";

// Styled Components
import {Card} from '../../elements'

class AllQuestions extends Component {
render() {
const {questions} = this.props;

return (
<ul className="AllQuestions">
<div className="AllQuestions">
{questions.map(question => {
return (
<li key={question._id}>
<Card key={question._id}>
<Link to={`/questions/${question._id}`}>{question.title}</Link> -
{question.user ?
<Link to={`/users/${question.user._id}/${question.user.name}`}>{question.user.name}</Link> :
'User deleted profile :('
}
</li>
</Card>
)
})}
</ul>
</div>
)
}
}
Expand Down
13 changes: 11 additions & 2 deletions client/src/elements/Buttons.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
import styled from 'styled-components'
import {darken} from 'polished'
import {blue, elevation} from '../utils'

export const Button = styled.button`
padding: 5px 20px;
border-radius: 4px;
color: white;
font-size: 2rem;
font-size: 1rem;
border: none;
background: indigo;
background: ${blue};
${elevation[1]};
transition: 0.3s ease all;
&:hover {
${elevation[2]};
background: ${darken(0.2, blue)};
}
`;

export const CancelButton = styled(Button)`
Expand Down
7 changes: 7 additions & 0 deletions client/src/elements/Cards.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import styled from 'styled-components'
import {lighterblack} from '../utils'

export const Card = styled.div`
padding: 12px 8px;
border-bottom: 1px solid ${lighterblack};
`;
3 changes: 2 additions & 1 deletion client/src/elements/index.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export * from './Headings'
export * from './Buttons'
export * from './Buttons'
export * from './Cards'
3 changes: 2 additions & 1 deletion client/src/utils/Colors.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ export const green = '#92EEC4'
export const blue = '#85DAEF'
export const lightblue = '#8EEEEF'
export const black = '#242729'
export const lightblack = '#848d95'
export const lightblack = '#848d95'
export const lighterblack = '#eff0f1'

0 comments on commit 2edabfb

Please sign in to comment.