Skip to content

Commit a4d35d1

Browse files
ltclmbdevjoelhooks
authored andcommitted
UI tweaks (#6)
* fix breakpoints * fix missed brace * adjust link-in-the-title styles * refactorPostTitle * fix font smoothing * made images go from edge to edge * fix images
1 parent e2a8466 commit a4d35d1

File tree

6 files changed

+70
-50
lines changed

6 files changed

+70
-50
lines changed

src/components/Layout.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export const globalStyles = css`
2121
}
2222
${bpMaxSM} {
2323
h1 {
24-
font-size: 30px;
24+
font-size: 28px;
2525
}
2626
h2 {
2727
font-size: 24px;
@@ -41,6 +41,14 @@ export const globalStyles = css`
4141
font-family: ${fonts.semiboldItalic};
4242
}
4343
}
44+
h1,
45+
h2,
46+
h3,
47+
h4 {
48+
a {
49+
color: inherit;
50+
}
51+
}
4452
input {
4553
border-radius: 4px;
4654
border: 1px solid ${theme.colors.gray};

src/lib/breakpoints.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export const bpMinLG = `@media (min-width: ${minLG}px)`
1010
export const bpMinXL = `@media (min-width: ${minXL}px)`
1111
export const bpMinXXL = `@media (min-width: ${minXXL}px)`
1212

13-
export const bpMaxXS = `'@media (max-width: ${minSM - 1}px)'`
14-
export const bpMaxSM = `'@media (max-width: ${minMD - 1}px)'`
15-
export const bpMaxMD = `'@media (max-width: ${minLG - 1}px)'`
16-
export const bpMaxLG = `'@media (max-width: ${minXL - 1}px)'`
13+
export const bpMaxXS = `@media (max-width: ${minSM - 1}px)`
14+
export const bpMaxSM = `@media (max-width: ${minMD - 1}px)`
15+
export const bpMaxMD = `@media (max-width: ${minLG - 1}px)`
16+
export const bpMaxLG = `@media (max-width: ${minXL - 1}px)`

src/lib/reset.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ ul, ol {
3030
box-sizing: border-box;
3131
-ms-overflow-style: scrollbar;
3232
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
33-
33+
-webkit-font-smoothing: antialiased;
34+
-moz-osx-font-smoothing: grayscale;
35+
}
3436
body {
3537
color: ${theme.colors.body_color};
3638
background-color: ${theme.colors.bg_color};

src/pages/index.js

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,6 @@ const Hero = ({ description }) => (
4747
</section>
4848
)
4949

50-
const PostTitle = styled.h2`
51-
margin-bottom: ${rhythm(0.3)};
52-
transition: ${theme.transition.ease};
53-
:hover {
54-
color: ${theme.brand.primary};
55-
transition: ${theme.transition.ease};
56-
}
57-
`
58-
5950
const Description = styled.p`
6051
margin-bottom: 10px;
6152
display: inline-block;
@@ -81,12 +72,22 @@ export default function Index({ data: { site, allMdx } }) {
8172
margin-bottom: 40px;
8273
`}
8374
>
84-
<Link
85-
to={post.frontmatter.slug}
86-
aria-label={`View ${post.frontmatter.title}`}
75+
<h2
76+
css={css({
77+
marginBottom: rhythm(0.3),
78+
transition: theme.transition.ease,
79+
':hover': {
80+
color: theme.brand.primary,
81+
},
82+
})}
8783
>
88-
<PostTitle>{post.frontmatter.title}</PostTitle>
89-
</Link>
84+
<Link
85+
to={post.frontmatter.slug}
86+
aria-label={`View ${post.frontmatter.title}`}
87+
>
88+
{post.frontmatter.title}
89+
</Link>
90+
</h2>
9091
<Description>
9192
{post.excerpt}{' '}
9293
<Link

src/templates/blog.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import Container from 'components/Container'
66
import SEO from '../components/SEO'
77
import Layout from '../components/Layout'
88
import Link from '../components/Link'
9-
import { bpMaxSM } from '../lib/breakpoints'
9+
import { bpMaxSM, bpMinMD } from '../lib/breakpoints'
1010

1111
const Blog = ({
1212
data: { site, allMdx },
@@ -18,8 +18,9 @@ const Blog = ({
1818
.map(id =>
1919
allMdx.edges.find(
2020
edge =>
21-
edge.node.id === id && edge.node.parent.sourceInstanceName !== 'pages'
22-
)
21+
edge.node.id === id &&
22+
edge.node.parent.sourceInstanceName !== 'pages',
23+
),
2324
)
2425
.filter(post => post !== undefined)
2526

@@ -58,25 +59,25 @@ const Blog = ({
5859
margin-top: 20px;
5960
}
6061
}
61-
.gatsby-image-wrapper {
62-
}
6362
background: white;
6463
padding: 40px;
6564
${bpMaxSM} {
66-
padding: 20px;
65+
padding: ${post.frontmatter.banner
66+
? '0 20px 20px 20px'
67+
: '20px'};
6768
}
6869
display: flex;
6970
flex-direction: column;
7071
`}
7172
>
7273
{post.frontmatter.banner && (
7374
<div
74-
css={css`
75-
padding: 60px 60px 40px 60px;
76-
${bpMaxSM} {
77-
padding: 20px;
78-
}
79-
`}
75+
css={css({
76+
margin: '0 -20px 30px -20px',
77+
[bpMinMD]: {
78+
margin: '0 0 40px 0',
79+
},
80+
})}
8081
>
8182
<Link
8283
aria-label={`View ${post.frontmatter.title} article`}
@@ -88,8 +89,7 @@ const Blog = ({
8889
)}
8990
<h2
9091
css={css`
91-
margin-top: 30px;
92-
margin-bottom: 10px;
92+
margin: 0 0 20px 0;
9393
`}
9494
>
9595
<Link

src/templates/post.js

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import Container from 'components/Container'
88
import Layout from '../components/Layout'
99
import Share from '../components/Share'
1010
import config from '../../config/website'
11-
import { bpMaxSM } from '../lib/breakpoints'
11+
import { bpMaxSM, bpMinMD, bpMinLG } from '../lib/breakpoints'
1212
import get from 'lodash/get'
1313

1414
export default function Post({
@@ -29,36 +29,45 @@ export default function Post({
2929
isBlogPost
3030
/>
3131
<article
32-
css={css`
33-
width: 100%;
34-
display: flex;
35-
`}
32+
css={css({
33+
width: '100%',
34+
display: 'flex',
35+
'.gatsby-resp-image-link': {
36+
margin: '0 -20px',
37+
[bpMinMD]: {
38+
margin: 0,
39+
},
40+
},
41+
})}
3642
>
3743
<Container>
3844
<h1
39-
css={css`
40-
text-align: center;
41-
margin-bottom: 20px;
42-
`}
45+
css={css({
46+
textAlign: 'center',
47+
margin: '0 0 30px 0',
48+
[bpMinMD]: {
49+
margin: '0 0 50px 0',
50+
},
51+
})}
4352
>
4453
{title}
4554
</h1>
4655
{banner && (
4756
<div
48-
css={css`
49-
padding: 30px;
50-
${bpMaxSM} {
51-
padding: 0;
52-
}
53-
`}
57+
css={css({
58+
margin: '0 -20px 30px -20px',
59+
[bpMinMD]: {
60+
width: '90%',
61+
margin: '0 auto 50px auto',
62+
},
63+
})}
5464
>
5565
<Img
5666
sizes={banner.childImageSharp.fluid}
5767
alt={site.siteMetadata.keywords.join(', ')}
5868
/>
5969
</div>
6070
)}
61-
<br />
6271
<MDXRenderer>{mdx.code.body}</MDXRenderer>
6372
</Container>
6473
{/* <SubscribeForm /> */}

0 commit comments

Comments
 (0)