Skip to content

Commit 1a351bb

Browse files
committed
Change to reactstrap and customize styles
1 parent 547b274 commit 1a351bb

File tree

8 files changed

+75
-42
lines changed

8 files changed

+75
-42
lines changed

gatsby-config.js

+12-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,16 @@ module.exports = {
22
siteMetadata: {
33
title: 'Know Your User',
44
},
5-
plugins: ['gatsby-plugin-react-helmet', 'gatsby-plugin-sass'],
5+
plugins: [
6+
'gatsby-plugin-react-helmet',
7+
'gatsby-plugin-sass',
8+
{
9+
resolve: `gatsby-plugin-google-fonts`,
10+
options: {
11+
fonts: [
12+
`open sans\:400,700`
13+
]
14+
}
15+
}
16+
],
617
}

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"bootstrap": "^4.1.1",
88
"gatsby": "^1.9.247",
99
"gatsby-link": "^1.6.40",
10+
"gatsby-plugin-google-fonts": "^0.0.4",
1011
"gatsby-plugin-react-helmet": "^2.0.10",
1112
"gatsby-plugin-sass": "^1.0.26",
1213
"react": "^16.3.2",

src/layouts/index.js

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import React from 'react'
22
import PropTypes from 'prop-types'
33
import Helmet from 'react-helmet'
4-
import 'bootstrap/dist/css/bootstrap.css'
54
import '../styles/index.scss'
65

76
const Layout = ({ children, data }) => (

src/pages/index.js

+25-22
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,37 @@
11
import React from 'react'
22
import Link from 'gatsby-link'
33
import Testimonial from '../components/testimonial'
4-
import { Button } from 'reactstrap'
4+
import { Button, Container, Form, FormGroup, Input, Row, Col } from 'reactstrap'
55

66
const IndexPage = ({ Testimonial }) => (
7-
<div>
8-
<div>
9-
<h1>Get our best links every weekday</h1>
10-
<div>
11-
<p>
7+
<Container fluid>
8+
<Row className="hero">
9+
<Col sm="12" md={{ size: 9, offset: 1 }}>
10+
<h1 className="hero__title">Get our best links every weekday</h1>
11+
<p className="hero__subtitle">
1212
We handpick new content on product development, user experience,
1313
analytics, and more sent right to your inbox.
1414
</p>
15-
<div className="input">
16-
<input
17-
type="email"
18-
className="form-control"
19-
aria-describedby="emailHelp"
20-
placeholder="Your email adress"
21-
/>
22-
</div>
23-
<div className="subscribe-button">
24-
<button type="button" className="btn btn-primary">
15+
</Col>
16+
</Row>
17+
<Row className="subscription">
18+
<Col sm="12" md={{ size: 8, offset: 2 }}>
19+
<Form>
20+
<FormGroup className="subscription__email">
21+
<Input
22+
className="subscription__email__input"
23+
type="email"
24+
placeholder="Your email address"
25+
/>
26+
</FormGroup>
27+
<Button className="subscription__button" color="primary" block>
2528
Subscribe
26-
</button>
27-
</div>
28-
<div>{Testimonial}</div>
29-
</div>
30-
</div>
31-
</div>
29+
</Button>
30+
</Form>
31+
</Col>
32+
</Row>
33+
<div>{Testimonial}</div>
34+
</Container>
3235
)
3336

3437
export default IndexPage

src/styles/_variables.scss

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
$font-family-sans-serif: 'Open Sans', sans-serif;
2+
$primary: #3f51b5;

src/styles/index.scss

+5-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1-
@import 'pages/index.scss';
1+
@import 'variables';
2+
3+
@import '~bootstrap/scss/bootstrap';
4+
5+
@import 'pages/index';

src/styles/pages/_index.scss

+26-17
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,32 @@
1-
h1 {
2-
text-align: center;
3-
}
1+
.hero {
2+
@extend .text-center;
43

5-
.input {
6-
margin-bottom: 5px;
7-
text-align: center;
8-
}
4+
&__title {
5+
@extend .h2;
96

10-
.form-control {
11-
width: 45%;
12-
}
7+
color: $primary;
8+
font-weight: 700;
9+
margin-bottom: 2rem;
10+
}
1311

14-
.subscribe-button {
15-
text-align: center;
16-
display: block;
12+
&__subtitle {
13+
@extend .lead;
14+
15+
margin-bottom: 3rem;
16+
}
1717
}
1818

19-
.btn-primary {
20-
background-color: #3f51b5;
21-
border-color: #ccc;
22-
width: 45%;
19+
.subscription {
20+
&__email {
21+
margin-bottom: 0.5rem;
22+
23+
&__input {
24+
padding: 0.75rem;
25+
}
26+
}
27+
28+
&__button {
29+
font-weight: 700;
30+
padding: 0.75rem;
31+
}
2332
}

yarn.lock

+4
Original file line numberDiff line numberDiff line change
@@ -3235,6 +3235,10 @@ gatsby-module-loader@^1.0.11:
32353235
babel-runtime "^6.26.0"
32363236
loader-utils "^0.2.16"
32373237

3238+
gatsby-plugin-google-fonts@^0.0.4:
3239+
version "0.0.4"
3240+
resolved "https://registry.yarnpkg.com/gatsby-plugin-google-fonts/-/gatsby-plugin-google-fonts-0.0.4.tgz#dc1402a71f27c3ae6caee10777d10adadf74bd7c"
3241+
32383242
gatsby-plugin-react-helmet@^2.0.10:
32393243
version "2.0.11"
32403244
resolved "https://registry.yarnpkg.com/gatsby-plugin-react-helmet/-/gatsby-plugin-react-helmet-2.0.11.tgz#a2db81755f5b41d54e0e535ca1d9a008d3ccff0a"

0 commit comments

Comments
 (0)