Reset, clean up and bump deps
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import Image from "next/image";
|
||||
import Lightbox from "@/components/lightbox";
|
||||
import FilteredLightbox from "@/components/lightbox";
|
||||
import { type GetPhotos } from "@/app/api/photos/route";
|
||||
|
||||
async function getImageData(): Promise<GetPhotos> {
|
||||
@@ -12,7 +12,7 @@ export default async function Photos(): Promise<React.JSX.Element> {
|
||||
|
||||
return (
|
||||
<div className="mx-auto">
|
||||
<Lightbox imageData={imageData.images}>
|
||||
<FilteredLightbox imageData={imageData.images}>
|
||||
{imageData.images.map((image) => (
|
||||
<Image
|
||||
key={image.src}
|
||||
@@ -27,7 +27,7 @@ export default async function Photos(): Promise<React.JSX.Element> {
|
||||
placeholder="blur"
|
||||
/>
|
||||
))}
|
||||
</Lightbox>
|
||||
</FilteredLightbox>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -16,11 +16,8 @@ export async function generateStaticParams(): Promise<{slug: string[]}[]> {
|
||||
}
|
||||
|
||||
export default async function Post({params}: {params: Promise<{ slug: string[] }>}): Promise<React.JSX.Element> {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||
const mdxFile = await import(`../../../../markdown/posts/[...slug]/${(await params).slug.join('/')}.mdx`);
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-return
|
||||
const Post = dynamic(() => mdxFile);
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
||||
return (
|
||||
<Post/>
|
||||
);
|
||||
|
||||
@@ -22,12 +22,9 @@ async function loadPostDetails(): Promise<postDetails[]> {
|
||||
|
||||
const loadPostData = posts.map(async (post) => {
|
||||
const slug = [post.split('/').at(-1)!.slice(0, -4)];
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||
const mdxFile = await import(`../../../../src/markdown/posts/[...slug]/${slug.join('/')}.mdx`);
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
||||
return {
|
||||
link: getCurrentUrl() + '/posts/' + slug.join('/'),
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-assignment
|
||||
metadata: mdxFile.metadata,
|
||||
};
|
||||
});
|
||||
|
||||
@@ -63,7 +63,7 @@ function NextJsImage({ slide, offset, rect, unoptimized = false }: {slide: Image
|
||||
);
|
||||
}
|
||||
|
||||
export function MyLightbox({imageData, children}: {imageData: ImageData[], children: React.JSX.Element[]}): React.JSX.Element {
|
||||
export function Lightbox({imageData, children}: {imageData: ImageData[], children: React.JSX.Element[]}): React.JSX.Element {
|
||||
const [active, setActive] = useState<number | null>(null);
|
||||
|
||||
return (
|
||||
@@ -102,7 +102,7 @@ interface UsernameFormElement extends HTMLFormElement {
|
||||
readonly elements: FormElements
|
||||
}
|
||||
|
||||
export default function Test(props: {imageData: ImageData[], children: React.JSX.Element[]}): React.JSX.Element {
|
||||
export default function FilteredLightbox(props: {imageData: ImageData[], children: React.JSX.Element[]}): React.JSX.Element {
|
||||
const [imageData, setImageData] = useState(props.imageData);
|
||||
|
||||
function handleSubmit(event: React.FormEvent<UsernameFormElement>): void {
|
||||
@@ -124,9 +124,9 @@ export default function Test(props: {imageData: ImageData[], children: React.JSX
|
||||
</div>
|
||||
<button type="submit">Submit</button>
|
||||
</form>
|
||||
<MyLightbox imageData={imageData}>
|
||||
<Lightbox imageData={imageData}>
|
||||
{...children}
|
||||
</MyLightbox>
|
||||
</Lightbox>
|
||||
</>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user