Skip to content

Commit 82b887c

Browse files
committed
Refactor CSS styles and update navbar
1 parent 315109f commit 82b887c

20 files changed

Lines changed: 202 additions & 184 deletions

browser/create-template/templates/nextjs-site/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"private": true,
55
"scripts": {
66
"dev": "next dev --turbopack",
7-
"build": "ad-generate ontologies && next build",
7+
"build": "next build",
88
"start": "next start",
99
"lint": "next lint",
1010
"generate-ontologies": "ad-generate ontologies"

browser/create-template/templates/nextjs-site/src/app/[...slug]/error.tsx

Lines changed: 0 additions & 19 deletions
This file was deleted.

browser/create-template/templates/nextjs-site/src/app/[...slug]/page.tsx

Lines changed: 0 additions & 44 deletions
This file was deleted.
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import { getCurrentResource } from '@/atomic/getCurrentResource';
2+
import FullPageView from '@/views/FullPage/FullPageView';
3+
import { core } from '@tomic/lib';
4+
import type { Metadata } from 'next';
5+
import { notFound } from 'next/navigation';
6+
7+
type Params = {
8+
slug?: string[];
9+
};
10+
11+
type Props = {
12+
params: Promise<Params>;
13+
searchParams?: Promise<Record<string, string | string[] | undefined>>;
14+
};
15+
16+
const fetchResource = async (slug?: string[]) => {
17+
const path = slug ? `/${slug.join('/')}` : '/';
18+
return await getCurrentResource(path);
19+
};
20+
21+
export const generateMetadata = async ({
22+
params,
23+
}: Props): Promise<Metadata> => {
24+
const slug = (await params).slug;
25+
const resource = await fetchResource(slug);
26+
27+
return {
28+
title: resource?.title,
29+
description: resource?.get(core.properties.description),
30+
};
31+
};
32+
33+
const Page = async ({ params, searchParams }: Props) => {
34+
const slug = (await params).slug;
35+
const search = await searchParams;
36+
const resource = await fetchResource(slug);
37+
38+
if (!resource) {
39+
return notFound();
40+
}
41+
42+
return <FullPageView subject={resource.subject} searchParams={search} />;
43+
};
44+
45+
export default Page;

browser/create-template/templates/nextjs-site/src/app/globals.css

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,3 @@ body {
2222
margin: 0;
2323
padding: 0;
2424
}
25-
26-
p {
27-
margin-top: 1em;
28-
}

browser/create-template/templates/nextjs-site/src/app/page.tsx

Lines changed: 0 additions & 24 deletions
This file was deleted.

browser/create-template/templates/nextjs-site/src/components/MarkdownContent.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import matter from 'gray-matter';
55
import html from 'remark-html';
66
import { remark } from 'remark';
77
import { TextBlock } from '@/ontologies/website';
8+
import styles from '@/views/Block/TextBlock.module.css';
89

910
export const MarkdownContent = ({
1011
subject,
@@ -20,6 +21,7 @@ export const MarkdownContent = ({
2021

2122
return (
2223
<div
24+
className={styles.wrapper}
2325
dangerouslySetInnerHTML={{
2426
__html: resource.loading ? initialContent : processed.toString(),
2527
}}

browser/create-template/templates/nextjs-site/src/components/Searchbar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const Searchbar = () => {
2222
} else {
2323
router.push(`${pathname}?search=${throttledSearch}`);
2424
}
25-
}, [throttledSearch]);
25+
}, [throttledSearch, router, pathname]);
2626

2727
return (
2828
<div className={styles.searchBar}>

browser/create-template/templates/nextjs-site/src/views/Block/ImageGalleryBlock.module.css

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
minmax(calc(var(--theme-size-container-width) / 3 - 4rem), 1fr)
77
);
88
gap: 1rem;
9-
}
109

11-
.wrapper img {
12-
aspect-ratio: 1 / 1;
13-
object-fit: cover;
14-
height: auto;
10+
& img {
11+
aspect-ratio: 1 / 1;
12+
object-fit: cover;
13+
height: auto;
14+
}
1515
}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.wrapper {
22
max-width: 70ch;
3-
}
43

5-
.wrapper > p {
6-
margin-top: 1em;
4+
& p {
5+
margin-top: 1em;
6+
}
77
}

0 commit comments

Comments
 (0)