mirror of
https://github.com/mastermindzh/rickvanlieshout.com
synced 2025-07-27 12:42:28 +02:00
🔖 Upgrade to Gatsby 1.8.12
This commit is contained in:
46
src/components/Post/index.jsx
Normal file
46
src/components/Post/index.jsx
Normal file
@@ -0,0 +1,46 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import Link from 'gatsby-link';
|
||||
import moment from 'moment';
|
||||
import './style.scss';
|
||||
|
||||
class Post extends React.Component {
|
||||
render() {
|
||||
const data = this.props.data;
|
||||
const post = {
|
||||
title: data.node.frontmatter.title,
|
||||
slug: data.node.fields.slug,
|
||||
description: data.node.frontmatter.description,
|
||||
date: data.node.frontmatter.date,
|
||||
category: data.node.frontmatter.category,
|
||||
categorySlug: data.node.fields.categorySlug
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="post">
|
||||
<div className="post__meta">
|
||||
<time className="post__meta-time" dateTime={moment(post.date).format('MMMM D, YYYY')}>
|
||||
{moment(post.date).format('MMMM YYYY')}
|
||||
</time>
|
||||
<span className="post__meta-divider" />
|
||||
<span className="post__meta-category" key={post.categorySlug}>
|
||||
<Link to={post.categorySlug} className="post__meta-category-link">
|
||||
{post.category}
|
||||
</Link>
|
||||
</span>
|
||||
</div>
|
||||
<h2 className="post__title">
|
||||
<Link className="post__title-link" to={post.slug}>{post.title}</Link>
|
||||
</h2>
|
||||
<p className="post__description">{post.description}</p>
|
||||
<Link className="post__readmore" to={post.slug}>Read</Link>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Post.propTypes = {
|
||||
data: PropTypes.object.isRequired
|
||||
};
|
||||
|
||||
export default Post;
|
60
src/components/Post/style.scss
Normal file
60
src/components/Post/style.scss
Normal file
@@ -0,0 +1,60 @@
|
||||
@import "../../assets/scss/variables";
|
||||
@import "../../assets/scss/mixins";
|
||||
|
||||
.post {
|
||||
@include margin-bottom(1.25);
|
||||
&:last-child {
|
||||
@include margin-bottom(.5);
|
||||
}
|
||||
&__title {
|
||||
font-size: $typographic-base-font-size * 1.6875;
|
||||
@include line-height(1.5);
|
||||
@include margin-top(0);
|
||||
@include margin-bottom(.5);
|
||||
&-link {
|
||||
color: $color-base;
|
||||
&:hover,
|
||||
&:focus {
|
||||
color: $color-base;
|
||||
border-bottom: 1px solid $color-base;
|
||||
}
|
||||
}
|
||||
}
|
||||
&__description {
|
||||
font-size: $typographic-base-font-size;
|
||||
@include line-height(1);
|
||||
@include margin-bottom(.75);
|
||||
}
|
||||
&__meta {
|
||||
&-time {
|
||||
font-size: $typographic-small-font-size;
|
||||
color: $color-base;
|
||||
font-weight: 500;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
&-divider {
|
||||
margin: 0 5px;
|
||||
}
|
||||
&-category {
|
||||
&-link {
|
||||
font-size: $typographic-small-font-size;
|
||||
color: $color-secondary;
|
||||
font-weight: 500;
|
||||
text-transform: uppercase;
|
||||
&:hover,
|
||||
&:focus {
|
||||
color: $color-primary;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
&__readmore {
|
||||
font-size: $typographic-base-font-size;
|
||||
color: $color-primary;
|
||||
&:hover,
|
||||
&:focus {
|
||||
color: $color-primary;
|
||||
border-bottom: 1px solid $color-primary;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user