This repository has been archived on 2022-10-07. You can view files and clone it, but cannot push or open issues or pull requests.
skynet-webportal/packages/website/src/pages/news.js

68 lines
1.9 KiB
JavaScript
Raw Normal View History

2021-03-28 16:34:52 +00:00
import * as React from "react";
2021-03-31 22:37:02 +00:00
import { graphql } from "gatsby";
2021-03-31 23:01:32 +00:00
import Layout, { Section } from "../components/Layout";
2021-03-31 22:37:02 +00:00
import { Aside } from "../components/News";
import Link from "../components/Link";
2021-03-28 16:34:52 +00:00
import SEO from "../components/seo";
2021-03-31 22:37:02 +00:00
const NewsCard = ({ ...props }) => {
return (
<div className="flex flex-col">
2021-03-31 23:01:32 +00:00
<img src={`https://picsum.photos/320/170?${Math.random()}`} alt={props.frontmatter.title} />
2021-03-31 22:37:02 +00:00
<Link to={props.fields.slug} className="text-xl mt-6 hover:text-primary transition-colors duration-200">
{props.frontmatter.title}
</Link>
{props.frontmatter.description && (
<div className="font-content text-palette-400 mt-4">{props.frontmatter.description}</div>
)}
<div className="mt-6">
<Aside avatar={props.frontmatter.avatar} author={props.frontmatter.author} date={props.frontmatter.date} />
</div>
</div>
);
};
const NewsPage = ({ data }) => {
return (
<Layout>
<SEO title="News" />
<Section className="bg-white" first={true}>
<div className="grid grid-cols-1 desktop:grid-cols-3 gap-x-8 gap-y-24">
{data.allMarkdownRemark.edges.map(({ node }) => (
<NewsCard key={node.id} {...node} />
))}
</div>
</Section>
</Layout>
);
};
export const query = graphql`
query NewsQuery {
allMarkdownRemark(sort: { fields: frontmatter___date, order: DESC }) {
edges {
node {
id
frontmatter {
title
date(formatString: "MMMM DD, YYYY")
description
author
avatar {
childImageSharp {
gatsbyImageData(width: 40, placeholder: BLURRED, formats: [AUTO, WEBP, AVIF])
}
}
}
fields {
slug
}
}
}
}
}
`;
2021-03-28 16:34:52 +00:00
export default NewsPage;