Skip to content

Commit

Permalink
styling homepage heading
Browse files Browse the repository at this point in the history
  • Loading branch information
nickllerandi committed May 31, 2019
1 parent d77ff3a commit 5954522
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 12 deletions.
3 changes: 2 additions & 1 deletion client/src/Global.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ import {createGlobalStyle} from 'styled-components'
import {normalize} from 'polished'
import {black, white} from './utils'

// ${normalize()} removed from const GlobalStyle

const GlobalStyle = createGlobalStyle`
${normalize()}
* {
margin: 0;
Expand Down
48 changes: 42 additions & 6 deletions client/src/components/homepage/Homepage.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, {Component} from "react";
import {Link} from "react-router-dom";
import {connect} from "react-redux";
import styled from 'styled-components'

// Actions
import {getQuestions} from "../../actions/questionActions";
Expand All @@ -10,6 +11,7 @@ import AllQuestions from "../questions/AllQuestions";

// Styled Components
import {Heading, Button} from '../../elements'
import {lighterblack} from '../../utils'

class Homepage extends Component {
componentDidMount() {
Expand All @@ -20,19 +22,53 @@ class Homepage extends Component {
const {questions} = this.props.questionReducer;

return (
<div className="RecentQuestions">
<Heading>Recent Questions</Heading>
<Link to="/ask">
<Button>Ask a Question</Button>
</Link>
<HomepageStyled className="homepage">
<div className='homepage__heading'>
<h1 className='homepage__h1'>
Recent Questions
</h1>

<div className='homepage__ask-button'>
<Link to="/ask">
<Button>Ask a Question</Button>
</Link>
</div>
</div>

<AllQuestions
questions={questions}
/>
</div>
</HomepageStyled>
)
}
}

const HomepageStyled = styled.div`
.homepage {
&__heading {
display: flex;
justify-content: space-between;
align-items: center;
border-bottom: 1px solid ${lighterblack};
font-size: 1.35rem;
}
&__h1 {
font-weight: 300;
text-transform: uppercase;
letter-spacing: 1px;
padding: 1.5rem 3rem;
}
&__ask-button {
display: inline-block;
}
}
`

const mapStateToProps = state => ({
authReducer: state.authReducer,
questionReducer: state.questionReducer
Expand Down
22 changes: 20 additions & 2 deletions client/src/components/layout/Sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import styled from 'styled-components'
import sprites from '../../img/sprite.svg'

// UTILS
import {white} from '../../utils'
import {white, primary, secondary, secondary_light} from '../../utils'

const Sidebar = () => {
return (
Expand Down Expand Up @@ -52,17 +52,35 @@ const SidebarStyled = styled.div`
justify-content: space-between;
.side-nav {
font-size: 1.4rem;
list-style: none;
margin-top: 3.5rem;
&__item {
}
&__link {
&__link:link,
&__link:visited {
color: ${white};
text-decoration: none;
text-transform: uppercase;
display: block;
padding: 1.5rem 3rem;
display: flex;
align-items: center;
}
&__link:hover {
color: ${primary}
}
&__icon {
width: 1.75rem;
height: 1.75rem;
margin-right: 2rem;
fill: currentColor;
}
}
Expand Down
2 changes: 0 additions & 2 deletions client/src/components/questions/AllQuestions.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import styled from 'styled-components'
import {lighterblack, black, primary} from '../../utils'
import {darken} from 'polished'

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

class AllQuestions extends Component {
render() {
const {questions} = this.props;
Expand Down
2 changes: 1 addition & 1 deletion client/src/elements/Buttons.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const Button = styled.button`
padding: 5px 20px;
border-radius: 4px;
color: white;
font-size: 1.4rem;
font-size: inherit;
border: none;
background: ${secondary};
cursor: pointer;
Expand Down

0 comments on commit 5954522

Please sign in to comment.