Skip to content

Commit 225e1a5

Browse files
committed
Upgrade post and header layout
1 parent fb738cf commit 225e1a5

File tree

9 files changed

+1541
-1494
lines changed

9 files changed

+1541
-1494
lines changed

assets/screen.png

-209 KB
Loading

src/assets/logo.png

-3.66 KB
Loading

src/components/Header/Header.js

Lines changed: 39 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
import React from 'react';
22
import Link from 'gatsby-link';
33

4-
import LogoPNG from '../../assets/logo.png';
5-
64
import styles from './Header.module.css';
75

86
import { ThemeConsumer } from '../ThemeProvider';
9-
import Image from '../Image';
7+
import Grid from '../Grid';
8+
import Row from '../Row';
9+
import Col from '../Col';
1010

11-
export function HeaderLink(props) {
11+
export function HeaderExternalLink(props) {
1212
return (
1313
<ThemeConsumer>
1414
{theme => (
1515
<a
1616
{...props}
1717
style={{ color: theme.Blue }}
18-
className={styles.HeaderLink}
18+
className={styles.HeaderExternalLink}
1919
>
2020
{props.children}
2121
</a>
@@ -28,38 +28,40 @@ export default function Header() {
2828
return (
2929
<ThemeConsumer>
3030
{theme => (
31-
<header style={{ backgroundColor: theme.Darker }}>
32-
<div className={styles.Header}>
33-
<Link
34-
to="/"
35-
style={{ textDecoration: 'none', color: theme.Yellow }}
36-
>
37-
<div className={styles.HeaderLogoGroup}>
38-
<Image
39-
style={{ maxHeight: 32 }}
40-
src={LogoPNG}
41-
alt="Javascript Mérida"
42-
/>
43-
<p style={{ fontWeight: 'bold' }} className={styles.HeaderLink}>
44-
Away from Javascript
45-
</p>
46-
</div>
47-
</Link>
48-
<nav>
49-
<HeaderLink href="https://rss.simplecast.com/podcasts/10278/rss">
50-
RSS
51-
</HeaderLink>
52-
<HeaderLink href="https://open.spotify.com/show/2lFTjo5kc498PWOOg0fvum?si=4g0U4s43SSqu8ifdaKFR3A">
53-
Spotify
54-
</HeaderLink>
55-
<HeaderLink href="https://www.google.com/podcasts?feed=aHR0cHM6Ly9yc3Muc2ltcGxlY2FzdC5jb20vcG9kY2FzdHMvMTAyNzgvcnNz">
56-
Google Podcast
57-
</HeaderLink>
58-
<HeaderLink href="https://itunes.apple.com/mx/podcast/away-from-javascript/id1452959831?l=en&mt=2">
59-
iTunes
60-
</HeaderLink>
61-
</nav>
62-
</div>
31+
<header className={styles.Header}>
32+
<Grid>
33+
<Row center="xs">
34+
<Col xs md={8}>
35+
<Link
36+
to="/"
37+
style={{ textDecoration: 'none', color: theme.Darker }}
38+
>
39+
<div className={styles.HeaderLink}>
40+
<h1 style={{ fontWeight: 'bold' }}>Away from Javascript</h1>
41+
</div>
42+
</Link>
43+
</Col>
44+
</Row>
45+
46+
<Row center="xs">
47+
<Col xs md={8}>
48+
<nav>
49+
<HeaderExternalLink href="https://rss.simplecast.com/podcasts/10278/rss">
50+
RSS
51+
</HeaderExternalLink>
52+
<HeaderExternalLink href="https://open.spotify.com/show/2lFTjo5kc498PWOOg0fvum?si=4g0U4s43SSqu8ifdaKFR3A">
53+
Spotify
54+
</HeaderExternalLink>
55+
<HeaderExternalLink href="https://www.google.com/podcasts?feed=aHR0cHM6Ly9yc3Muc2ltcGxlY2FzdC5jb20vcG9kY2FzdHMvMTAyNzgvcnNz">
56+
Google Podcast
57+
</HeaderExternalLink>
58+
<HeaderExternalLink href="https://itunes.apple.com/mx/podcast/away-from-javascript/id1452959831?l=en&mt=2">
59+
iTunes
60+
</HeaderExternalLink>
61+
</nav>
62+
</Col>
63+
</Row>
64+
</Grid>
6365
</header>
6466
)}
6567
</ThemeConsumer>
Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
.Header {
2-
display: flex;
3-
padding: 12px;
4-
justify-content: space-between;
5-
align-items: center;
6-
max-width: 76rem;
7-
margin: auto;
2+
padding: 48px 0px;
83
}
94

105
.HeaderLogoGroup {
@@ -13,5 +8,9 @@
138
}
149

1510
.HeaderLink {
16-
margin-left: 12px;
11+
margin-bottom: 24px;
12+
}
13+
14+
.HeaderExternalLink {
15+
margin: 0px 12px;
1716
}

src/components/Post/Post.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import Row from '../Row';
1010
import Col from '../Col';
1111
import Image from '../Image';
1212

13-
export default function Post({ image, title, description, published }) {
13+
export default function Post({ ep, image, title, description, published }) {
1414
return (
1515
<ThemeConsumer>
1616
{theme => (
@@ -20,17 +20,16 @@ export default function Post({ image, title, description, published }) {
2020
>
2121
<article className={styles.Post}>
2222
<Row>
23-
<Col xs={3}>
23+
<Col xs={2}>
2424
<Image className={styles.PostImage} src={image} alt={title} />
2525
</Col>
2626
<Col xs>
2727
<div>
28-
<p style={{ color: theme.Dark }}>{published}</p>
2928
<h2
3029
className={`subtitle ${styles.PostTitle}`}
3130
style={{ color: theme.Darker }}
3231
>
33-
{title}
32+
{ep ? `${ep}: ${title}` : title}
3433
</h2>
3534
<div
3635
style={{ color: theme.Dark }}

src/components/Post/Post.module.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
.Post {
22
margin-bottom: 24px;
33
padding: 24px 12px;
4+
text-align: start;
45
}
56

67
.PostTitle {
78
margin-bottom: 12px;
8-
margin-top: 8px;
99
}
1010

1111
.PostImage {

src/pages/index.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import React from 'react';
22
import { graphql } from 'gatsby';
33

4+
import LogoPNG from '../assets/logo.png';
5+
46
import BaseLayout from '../layouts/BaseLayout';
57
import Post from '../components/Post';
68
import Grid from '../components/Grid';
@@ -19,12 +21,13 @@ function IndexPage({ data }) {
1921
>
2022
<Page>
2123
<Grid>
22-
{posts.map(post => (
23-
<Row>
24-
<Col xs key={post.node.id}>
24+
{posts.map((post, index) => (
25+
<Row center="xs">
26+
<Col xs md={8} key={post.node.id}>
2527
<Post
28+
ep={posts.length - index}
2629
published={post.node.published}
27-
image={post.node.image}
30+
image={LogoPNG}
2831
title={post.node.title}
2932
description={post.node.description}
3033
/>

src/templates/post.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import React from 'react';
22
import { graphql } from 'gatsby';
33
import ReactAudioPlayer from 'react-audio-player';
44

5+
import LogoPNG from '../assets/logo.png';
6+
57
import { ThemeConsumer } from '../components/ThemeProvider';
68
import BaseLayout from '../layouts/BaseLayout';
79
import Post from '../components/Post';
@@ -24,8 +26,8 @@ export default function PostTemplate(props) {
2426
{theme => (
2527
<Page>
2628
<Grid>
27-
<Row>
28-
<Col xs>
29+
<Row center="xs">
30+
<Col xs md={8}>
2931
<ReactAudioPlayer
3032
style={{
3133
width: '100%',
@@ -38,7 +40,7 @@ export default function PostTemplate(props) {
3840
/>
3941
<Post
4042
published={post.node.published}
41-
image={post.node.image}
43+
image={LogoPNG}
4244
title={post.node.title}
4345
description={post.node.description}
4446
/>

0 commit comments

Comments
 (0)