[examples/openspending][sm] - remove links + fix bug

This commit is contained in:
Luccas Mateus de Medeiros Gomes 2023-05-30 14:44:56 -03:00
parent 4095247ca6
commit c6f8199cf0
2 changed files with 0 additions and 66 deletions

View File

@ -53,18 +53,10 @@ export function Header() {
title: 'Resources',
href: '/resources',
children: [
{
title: 'IATI',
href: '/resources/iati',
},
{
title: 'Follow the money',
href: '/resources/journo',
},
{
title: 'OpenSpending.Mobi',
href: '/resources/mobi/',
},
{
title: 'Map of Spending Projects',
href: '/resources/map-of-spending-projects/',
@ -125,7 +117,6 @@ function classNames(...classes) {
function Dropdown({ navItem }: { navItem: any }) {
const [showDropDown, setShowDropDown] = useState(false);
console.log(showDropDown);
return (
<Menu as="div" className="relative inline-block text-left">
{({ open }) => (

View File

@ -1,57 +0,0 @@
import fs from 'fs';
import React from 'react';
import { GetStaticProps, GetStaticPropsResult } from 'next';
import { BlogsList, SimpleLayout } from '@flowershow/core';
import clientPromise from '../../lib/mddb';
import computeFields from '../../lib/computeFields';
import type { CustomAppProps } from '../_app';
import Layout from '@/components/_shared/Layout';
interface BlogIndexPageProps extends CustomAppProps {
blogs: any[]; // TODO types
}
export default function Blog({
blogs,
meta: { title, description },
}: BlogIndexPageProps) {
return (
<Layout>
<div className="blog-list">
<SimpleLayout title={title} description={description}>
<BlogsList blogs={blogs} />
</SimpleLayout>
</div>
</Layout>
);
}
export const getStaticProps: GetStaticProps = async () => {
const mddb = await clientPromise;
const blogFiles = await mddb.getFiles({ folder: 'blog' });
const blogs = blogFiles.map((item) => ({
_id: item._id,
file_path: item.file_path,
urlPath: item.url_path,
date: item.url_path.split('/').slice(-1)[0].split('-').slice(0,3).join('-'),
...item.metadata
}));
console.log(blogs[0].date)
return {
props: {
meta: {
title: 'Blog posts',
showSidebar: false,
showToc: false,
showComments: false,
showEditLink: false,
urlPath: '/blog',
},
blogs,
},
};
};