Skip to content
Snippets Groups Projects
To find the state of this project's repository at the time of any of these versions, check out the tags.
news.tsx 1.39 KiB
import React, { ReactElement } from "react"
import { Link } from "gatsby"

import { Content } from "@onegeo/gatsby-theme-onegeo"
import { News } from "@onegeo/gatsby-theme-onegeo"

function news(): ReactElement {
    return (
        <Content>
            <div className="prose">
                <Link to="/doc">Retour</Link>

                <h1>News</h1>
                <h2>Props</h2>
                <div className="mockup-code">
                    <pre>
                        <code>
                            {`
interface INews {
  title?: string;
  action?: {
    title?: string;
    to?: string;
    classname?: string;
  };
  anime?: boolean;
}

GraphQL query

  query {
    directus {
      news(
        limit: 3
        filter: { status: { _eq: "published" } }
        sort: "-date_published"
      ) {
        id
        content
        title
        date_published
        image {
          id
          imageFile {
            childImageSharp {
              gatsbyImageData
            }
          }
        }
      }
    }
  }
`}
                        </code>
                    </pre>
                </div>

                <h2>Example</h2>
            </div>
            <News
                title="Actualités"
                action={{
                    title: "Plus d'actualités",
                    to: "#",
                }}
            />
        </Content>
    )
}

export default news