Skip to content

Commit

Permalink
フォーマット
Browse files Browse the repository at this point in the history
  • Loading branch information
Hiroshiba committed Jun 24, 2024
1 parent 230a2bf commit 5d4dde7
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 15 deletions.
4 changes: 2 additions & 2 deletions gatsby-node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* See: https://www.gatsbyjs.com/docs/node-apis/
*/
import type { GatsbyNode } from "gatsby"
import { characterKeys, characterInfos } from "./src/constants"
import path from "path"
import { characterInfos, characterKeys } from "./src/constants"

export const sourceNodes: GatsbyNode["sourceNodes"] = async ({
actions,
Expand Down Expand Up @@ -34,7 +34,7 @@ export const sourceNodes: GatsbyNode["sourceNodes"] = async ({

export const createPages: GatsbyNode["createPages"] = async ({
actions,
graphql
graphql,
}) => {
const { createPage } = actions

Expand Down
18 changes: 10 additions & 8 deletions src/pages/news/index.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { Link, graphql, useStaticQuery } from "gatsby"
import React from "react"
import "../../components/layout.scss"
import { Page } from "../../components/page"
import Seo from "../../components/seo"
import { Link, graphql, useStaticQuery } from "gatsby"
import shareThumb from "../../images/nemo/share-thumbnail.png"

const NewsIndex = () => {
const data = useStaticQuery<Queries.IndexPageQuery>(graphql`
query IndexPage {
allMarkdownRemark (
filter: {fileAbsolutePath: {regex: "/news/"}}
sort: {frontmatter: {date: DESC}}
allMarkdownRemark(
filter: { fileAbsolutePath: { regex: "/news/" } }
sort: { frontmatter: { date: DESC } }
) {
edges {
node {
Expand All @@ -24,7 +24,7 @@ const NewsIndex = () => {
}
}
}
`);
`)

return (
<Page>
Expand All @@ -36,13 +36,15 @@ const NewsIndex = () => {
/>
<section className="section">
<div className="container is-max-desktop">
<h1 className="title">ニュース</h1>
{data.allMarkdownRemark.edges.map((edge) => (
<h1 className="title">ニュース</h1>
{data.allMarkdownRemark.edges.map(edge => (
<div key={edge.node.frontmatter!.slug} className="mb-3">
<Link to={`/news/${edge.node.frontmatter!.slug}`}>
{edge.node.frontmatter!.title}
</Link>
<p className="has-text-grey-light">{edge.node.frontmatter!.date}</p>
<p className="has-text-grey-light">
{edge.node.frontmatter!.date}
</p>
</div>
))}
</div>
Expand Down
10 changes: 5 additions & 5 deletions src/templates/newsPost.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { graphql } from "gatsby"
import React from "react"
import "../components/layout.scss"
import { Page } from "../components/page"
import Seo from "../components/seo"
import { graphql } from "gatsby"

const NewsPost = ({ data }) => {
const { markdownRemark } = data;
const { frontmatter, html } = markdownRemark;
const { markdownRemark } = data
const { frontmatter, html } = markdownRemark

return (
<Page>
Expand All @@ -30,7 +30,7 @@ const NewsPost = ({ data }) => {
}

export const query = graphql`
query($slug: String!) {
query ($slug: String!) {
markdownRemark(frontmatter: { slug: { eq: $slug } }) {
html
frontmatter {
Expand All @@ -40,6 +40,6 @@ export const query = graphql`
}
}
}
`;
`

export default NewsPost

0 comments on commit 5d4dde7

Please sign in to comment.