Skip to content

Commit 82b887c

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

20 files changed

+202
-184
lines changed

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

+1-1
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

-19
This file was deleted.

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

-44
This file was deleted.
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

-4
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

-24
This file was deleted.

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

+2
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

+1-1
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

+5-5
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
}
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
}

browser/create-template/templates/nextjs-site/src/views/DefaultView.tsx

+4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
import { Resource } from '@tomic/react';
22

33
const DefaultView = async ({ resource }: { resource: Resource }) => {
4+
console.error(
5+
`Error: Unable to find a valid page view for the specified class: "${resource.getClasses}". Please ensure that the class is correctly matched using matchClass. See documentation for details: https://docs.atomicdata.dev/js-lib/resource.html?highlight=matchClass#resourcematchclass`,
6+
);
7+
48
return <p>No supported view for {resource.title}.</p>;
59
};
610

browser/create-template/templates/nextjs-site/src/views/FullPage/BlogIndexPageFullPage.tsx

+1-3
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@ const BlogIndexPageFullPage = async ({
1616
searchParams,
1717
}: {
1818
resource: Resource<Page>;
19-
searchParams?: {
20-
[key: string]: Record<string, string | string[] | undefined>;
21-
};
19+
searchParams?: Record<string, string | string[] | undefined>;
2220
}) => {
2321
const allItems = await getAllBlogposts();
2422
let results: string[] = [];

browser/create-template/templates/nextjs-site/src/views/FullPage/BlogpostFullPage.module.css

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
.blogWrapper {
22
padding: 1rem;
3-
}
43

5-
.blogWrapper > picture > img {
6-
width: 100%;
7-
height: 25rem;
8-
object-fit: cover;
9-
border-radius: var(--theme-border-radius);
4+
& picture > img {
5+
width: 100%;
6+
height: 25rem;
7+
object-fit: cover;
8+
border-radius: var(--theme-border-radius);
9+
}
1010
}
1111

12-
.publishDate {
12+
.blogWrapper > .publishDate {
1313
color: var(--theme-color-text-light);
1414
margin-bottom: 2rem;
1515
}

browser/create-template/templates/nextjs-site/src/views/FullPage/DefaultFullPage.tsx

+4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ import Container from '@/components/Layout/Container';
22
import { Resource } from '@tomic/lib';
33

44
const DefaultFullPage = async ({ resource }: { resource: Resource }) => {
5+
console.error(
6+
`Error: Unable to find a valid page view for the specified class: "${resource.getClasses}". Please ensure that the class is correctly matched using matchClass. See documentation for details: https://docs.atomicdata.dev/js-lib/resource.html?highlight=matchClass#resourcematchclass`,
7+
);
8+
59
return (
610
<Container>
711
<h1>{resource.title}</h1>

browser/create-template/templates/nextjs-site/src/views/FullPage/FullPageView.tsx

+1-3
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@ const FullPageView = async ({
1010
searchParams,
1111
}: {
1212
subject: string;
13-
searchParams?: {
14-
[key: string]: Record<string, string | string[] | undefined>;
15-
};
13+
searchParams?: Record<string, string | string[] | undefined>;
1614
}) => {
1715
const resource = await store.getResource(subject);
1816

browser/create-template/templates/nextjs-site/src/views/FullPage/PageFullPage.module.css

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
display: flex;
44
flex-direction: column;
55
gap: 1rem;
6-
}
76

8-
.wrapper > h1 {
9-
margin: 0;
7+
& h1 {
8+
margin: 0;
9+
}
1010
}

browser/create-template/templates/nextjs-site/src/views/ListItem/BlogListItem.module.css

+48-48
Original file line numberDiff line numberDiff line change
@@ -6,53 +6,53 @@
66
border: 1px solid var(--border-color);
77
border-radius: var(--theme-border-radius);
88
overflow: clip;
9-
}
10-
11-
.card img {
12-
aspect-ratio: 21 / 9;
13-
object-fit: cover;
14-
transition: transform 300ms ease-in-out;
15-
height: auto;
16-
}
17-
18-
.card:hover {
19-
border-color: var(--theme-color-accent);
20-
}
21-
22-
.card:hover img {
23-
transform: scale(1.1);
24-
}
25-
26-
.publishDate {
27-
color: var(--theme-color-text-light);
28-
}
29-
30-
.imageWrapper {
31-
aspect-ratio: 21 / 9;
32-
overflow: clip;
33-
}
34-
35-
.cardContent {
36-
padding: 1rem;
37-
height: 15rem;
38-
overflow: clip;
39-
position: relative;
40-
}
41-
42-
.cardContent::after {
43-
content: '';
44-
pointer-events: none;
45-
position: absolute;
46-
inset: 0;
47-
background: linear-gradient(0deg, white 0%, transparent 100%);
48-
}
49-
50-
.h2 {
51-
font-size: 1.2rem;
52-
margin: 0;
53-
text-wrap: balance;
54-
}
559

56-
.p {
57-
color: black;
10+
& img {
11+
aspect-ratio: 21 / 9;
12+
object-fit: cover;
13+
transition: transform 300ms ease-in-out;
14+
height: auto;
15+
}
16+
17+
&:hover {
18+
border-color: var(--theme-color-accent);
19+
20+
& img {
21+
transform: scale(1.1);
22+
}
23+
}
24+
25+
.publishDate {
26+
color: var(--theme-color-text-light);
27+
}
28+
29+
.imageWrapper {
30+
aspect-ratio: 21 / 9;
31+
overflow: clip;
32+
}
33+
34+
.cardContent {
35+
padding: 1rem;
36+
height: 15rem;
37+
overflow: clip;
38+
position: relative;
39+
40+
&::after {
41+
content: '';
42+
pointer-events: none;
43+
position: absolute;
44+
inset: 0;
45+
background: linear-gradient(0deg, white 0%, transparent 100%);
46+
}
47+
}
48+
49+
.h2 {
50+
font-size: 1.2rem;
51+
margin: 0;
52+
text-wrap: balance;
53+
}
54+
55+
.p {
56+
color: black;
57+
}
5858
}

0 commit comments

Comments
 (0)