soames-gatsby-theme
Version:
A customizable Gatsby theme for personal websites using WordPress as a headless CMS.
31 lines (30 loc) • 1.97 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const jsx_runtime_1 = require("react/jsx-runtime");
const gatsby_1 = require("gatsby");
const html_react_parser_1 = __importDefault(require("html-react-parser"));
const BlogSidebar = ({ postId }) => {
const data = (0, gatsby_1.useStaticQuery)((0, gatsby_1.graphql) `
query SidebarPostArchive {
posts: allWpPost(sort: { date: DESC }) {
nodes {
id
excerpt
uri
date(formatString: "MMMM DD, YYYY")
title
featuredImage {
node {
guid
}
}
}
}
}
`);
return ((0, jsx_runtime_1.jsx)("section", { className: "soames-blog-roll pt-3", children: (0, jsx_runtime_1.jsx)("div", { className: "container", children: data.posts.nodes.map((post, index) => post.id !== postId ? ((0, jsx_runtime_1.jsx)("div", { className: "media-container-row", children: (0, jsx_runtime_1.jsx)("div", { className: "card p-3 col-12", children: (0, jsx_runtime_1.jsxs)("div", { className: "card-wrapper", children: [(0, jsx_runtime_1.jsxs)("div", { className: "card-box", children: [(0, jsx_runtime_1.jsx)("h4", { className: "card-title mbr-fonts-style display-5", children: (0, html_react_parser_1.default)(post.title) }), (0, jsx_runtime_1.jsx)("h4", { className: "mbr-fonts-style display-7", children: post.date }), (0, html_react_parser_1.default)(post.excerpt)] }), (0, jsx_runtime_1.jsx)("div", { className: "mbr-section-btn text-center", children: (0, jsx_runtime_1.jsx)(gatsby_1.Link, { to: `/blog${post.uri}`, itemProp: "url", className: "btn btn-primary display-4", children: (0, jsx_runtime_1.jsx)("span", { itemProp: "headline", children: "Read More" }) }) })] }) }) }, index)) : null) }) }));
};
exports.default = BlogSidebar;