2022-01-09 21:12:31 +01:00
|
|
|
import React from "react";
|
2018-11-09 18:08:48 +01:00
|
|
|
|
2022-01-09 21:12:31 +01:00
|
|
|
import { Link } from "gatsby";
|
|
|
|
|
|
|
|
import { Layout } from "@/components/Layout";
|
|
|
|
import { Page } from "@/components/Page";
|
|
|
|
import { Sidebar } from "@/components/Sidebar";
|
|
|
|
import { useCategoriesList, useSiteMetadata } from "@/hooks";
|
|
|
|
import { toKebabCase } from "@/utils";
|
|
|
|
|
2022-04-16 16:25:55 +02:00
|
|
|
const CategoriesTemplate: React.FC = () => {
|
2019-05-09 15:57:42 +02:00
|
|
|
const { title, subtitle } = useSiteMetadata();
|
|
|
|
const categories = useCategoriesList();
|
2018-11-09 18:08:48 +01:00
|
|
|
|
|
|
|
return (
|
|
|
|
<Layout title={`Categories - ${title}`} description={subtitle}>
|
|
|
|
<Sidebar />
|
|
|
|
<Page title="Categories">
|
|
|
|
<ul>
|
2022-04-24 18:21:11 +02:00
|
|
|
{categories.map((category) => (
|
2018-11-09 18:08:48 +01:00
|
|
|
<li key={category.fieldValue}>
|
2022-01-09 21:12:31 +01:00
|
|
|
<Link to={`/category/${toKebabCase(category.fieldValue)}/`}>
|
2018-11-09 18:08:48 +01:00
|
|
|
{category.fieldValue} ({category.totalCount})
|
|
|
|
</Link>
|
|
|
|
</li>
|
|
|
|
))}
|
|
|
|
</ul>
|
|
|
|
</Page>
|
|
|
|
</Layout>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2022-04-16 16:25:55 +02:00
|
|
|
export default CategoriesTemplate;
|