import React from "react" import { Link, graphql } from "gatsby" import { Main } from "../ui/ui" import { Grid, Row, Col } from "react-flexbox-grid" import useSiteMetadataQuery from "../hooks/useSiteMetadataQuery" import useSnippetsQuery from "../hooks/useSnippetsQuery" import SEO from "../components/SEO/SEO" import Articles from "../components/Articles/Articles" import Snippets from "../components/Snippets/Snippets" import SnippetItem from "../components/Snippets/SnippetItem/SnippetItem" import Offers from "../components/Offers/Offers" const IndexPage = ({ data: { allMarkdownRemark: edges } }) => { const { siteMetadata: { options: { articles: { onPage }, }, }, } = useSiteMetadataQuery() const { snippets } = useSnippetsQuery() let [limit, setLimit] = React.useState(onPage) return ( <>

Последние статьи

смотреть все
{snippets.length <= 0 ? null :

Сниппеты

} {snippets.map(({ node: { frontmatter } }, i) => ( ))}
) } export const query = graphql` { allMarkdownRemark( filter: { frontmatter: { templateKey: { eq: "article" } } } sort: { order: DESC, fields: frontmatter___date } ) { edges { node { frontmatter { slug title image { childImageSharp { fluid(maxWidth: 650, quality: 100) { ...GatsbyImageSharpFluid_withWebp } } } category tags description } } } } } ` export default IndexPage