Add Universe index page

This commit is contained in:
Marcus Blättermann 2022-11-17 00:11:38 +01:00
parent a2fc7ecb27
commit 7dac26df38
No known key found for this signature in database
GPG Key ID: A1E1F04008AC450D
2 changed files with 18 additions and 7 deletions

View File

@ -0,0 +1,17 @@
import recordSections from '../../meta/recordSections'
import Layout from '../../src/templates'
const Universe = () => {
return (
<Layout
slug={'/universe'}
section="universe"
sectionTitle={recordSections.universe.title}
theme={recordSections.universe.theme}
isIndex
title="Overview"
/>
)
}
export default Universe

View File

@ -21,12 +21,6 @@ import { github, MarkdownToReact } from '../components/util'
import { nightly, legacy } from '../../meta/dynamicMeta'
import universe from '../../meta/universe.json'
function getSlug(data) {
if (data.isCategory) return `/universe/category/${data.id}`
if (data.isProject) return `/universe/project/${data.id}`
return `/universe`
}
function filterResources(resources, data) {
const sorted = resources.sort((a, b) => a.id.localeCompare(b.id))
if (!data || !data.isCategory) return sorted
@ -38,7 +32,7 @@ const UniverseContent = ({ content = [], categories, theme, pageContext, mdxComp
const filteredResources = filterResources(content, data)
const activeData = data ? content.find(({ id }) => id === data.id) : null
const markdownComponents = { ...mdxComponents, code: InlineCode }
const slug = getSlug(data)
const slug = pageContext.slug
const isHome = !data.isCategory && !data.isProject
const sidebar = [