[examples/openspending][sm] - remove links + fix bug
This commit is contained in:
@@ -53,18 +53,10 @@ export function Header() {
|
|||||||
title: 'Resources',
|
title: 'Resources',
|
||||||
href: '/resources',
|
href: '/resources',
|
||||||
children: [
|
children: [
|
||||||
{
|
|
||||||
title: 'IATI',
|
|
||||||
href: '/resources/iati',
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
title: 'Follow the money',
|
title: 'Follow the money',
|
||||||
href: '/resources/journo',
|
href: '/resources/journo',
|
||||||
},
|
},
|
||||||
{
|
|
||||||
title: 'OpenSpending.Mobi',
|
|
||||||
href: '/resources/mobi/',
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
title: 'Map of Spending Projects',
|
title: 'Map of Spending Projects',
|
||||||
href: '/resources/map-of-spending-projects/',
|
href: '/resources/map-of-spending-projects/',
|
||||||
@@ -125,7 +117,6 @@ function classNames(...classes) {
|
|||||||
|
|
||||||
function Dropdown({ navItem }: { navItem: any }) {
|
function Dropdown({ navItem }: { navItem: any }) {
|
||||||
const [showDropDown, setShowDropDown] = useState(false);
|
const [showDropDown, setShowDropDown] = useState(false);
|
||||||
console.log(showDropDown);
|
|
||||||
return (
|
return (
|
||||||
<Menu as="div" className="relative inline-block text-left">
|
<Menu as="div" className="relative inline-block text-left">
|
||||||
{({ open }) => (
|
{({ open }) => (
|
||||||
|
|||||||
@@ -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,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
};
|
|
||||||
Reference in New Issue
Block a user