Skip to content
Snippets Groups Projects
Commit 86dc145f authored by Tovo Ramontalambo's avatar Tovo Ramontalambo Committed by Julien MARGAIL
Browse files

feat/news (sort by pinned)

parent bb9fb755
No related branches found
No related tags found
No related merge requests found
......@@ -12,6 +12,7 @@ interface INews {
classname?: string
}
anime?: boolean
size?: "xs" | "base" | "xl"
}
const News = (props: INews) => {
......@@ -21,7 +22,7 @@ const News = (props: INews) => {
news(
limit: 3
filter: { status: { _eq: "published" } }
sort: "-date_published"
sort: ["-pinned", "-date_published"]
) {
id
slug
......@@ -41,7 +42,7 @@ const News = (props: INews) => {
}
`)
const { title = "", anime = true, action } = props
const { title = "", anime = true, action, size = "xs" } = props
const news = data.directus.news.map((dtNew) => {
return {
......@@ -49,6 +50,7 @@ const News = (props: INews) => {
description: dtNew.content,
image: dtNew.image?.imageFile,
url: "/news/" + dtNew.slug,
size: size,
}
})
......
import React, { ReactElement } from "react"
import { } from "gatsby"
import {} from "gatsby"
import { Content,Link ,News } from "@onegeo/gatsby-theme-onegeo"
import { Content, Link, News } from "@onegeo/gatsby-theme-onegeo"
function news(): ReactElement {
return (
......@@ -23,6 +23,7 @@ interface INews {
classname?: string;
};
anime?: boolean;
size?: "xs" | "base" | "xl";
}
GraphQL query
......@@ -32,7 +33,7 @@ GraphQL query
news(
limit: 3
filter: { status: { _eq: "published" } }
sort: "-date_published"
sort: ["-pinned", "-date_published"]
) {
id
content
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment