Skip to content

Commit

Permalink
Merge pull request #16 from developmentseed/add-data-stories-component
Browse files Browse the repository at this point in the history
Add exposed Data Stories component
  • Loading branch information
dzole0311 authored Nov 28, 2024
2 parents 9eae23c + 1eb7d5a commit 646f516
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 8 deletions.
29 changes: 29 additions & 0 deletions app/(datasets)/stories/hub.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
'use client';
import React from 'react';
import { StoriesHubContent, useFiltersWithQS } from '@lib';
import Link from 'next/link';


export default function Hub({
stories: allStories
}: {
stories: any;
}) {
const controlVars = useFiltersWithQS();

return (
<StoriesHubContent
allStories={allStories}
onFilterchanges={() => controlVars}
storiesString= {{
one: 'story',
other: 'stories'
}}
linkProperties={{
LinkElement: Link,
pathAttributeKeyName: 'href'
}}
storiesPagePath={'stories'}
/>
);
}
8 changes: 4 additions & 4 deletions app/(datasets)/stories/page.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import React from 'react';
import { BlogPosts } from 'app/components/posts';
import { getStories } from 'app/content/utils/mdx';
import { getStoriesMetadata } from 'app/content/utils/mdx';
import Hub from './hub';

export default function Page() {
const posts = getStories();
const stories = getStoriesMetadata().map(d => ({...d.metadata, path: `stories/${d.slug}`}));

return (
<section>
<h1 className='font-semibold text-2xl mb-8 tracking-tighter'>Stories</h1>
<BlogPosts postType='story' posts={posts} />
<Hub stories={stories} />
</section>
);
}
2 changes: 1 addition & 1 deletion app/content/stories/lahina-fire.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ taxonomy:
center={[-156.68108, 20.88130]}
zoom={12}
datasetId='lahaina-fire'
layerId='hls-swir-falsecolor-composite'
layerId='landsat-nighttime-thermal'
dateTime='2023-08-08'
compareDateTime='2023-08-13'
/>
Expand Down
4 changes: 4 additions & 0 deletions app/content/utils/mdx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ function getMDXMetaData(dir) {
});
}

export function getStoriesMetadata() {
return getMDXMetaData(path.join(process.cwd(), 'app', 'content', 'stories'));
}

export function getDatasetsMetadata() {
return getMDXMetaData(path.join(process.cwd(), 'app', 'content', 'datasets'));
}
Expand Down
4 changes: 2 additions & 2 deletions app/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ import {
LogoContainer,
NavItem,
InternalNavLink,
NavItemType,
ExplorationAndAnalysis,
DatasetSelectorModal,
timelineDatasetsAtom,
useTimelineDatasetAtom,
StoriesHubContent,
externalDatasetsAtom
} from '@developmentseed/veda-ui';

Expand All @@ -47,6 +47,7 @@ export {
LogoContainer,
ExplorationAndAnalysis,
DatasetSelectorModal,
StoriesHubContent,

// MDX Components
Block,
Expand All @@ -56,7 +57,6 @@ export {
Image,
MapBlock,
CompareImage,
NavItemType,

// Hooks
useFiltersWithQS,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"fix": "yarn run format && yarn run lint:fix"
},
"dependencies": {
"@developmentseed/veda-ui": "v5.10.0-a",
"@developmentseed/veda-ui": "v5.11.0",
"@devseed-ui/theme-provider": "^4.1.0",
"@tailwindcss/postcss": "4.0.0-alpha.13",
"@types/node": "20.11.17",
Expand Down

0 comments on commit 646f516

Please sign in to comment.