mirror of
https://github.com/Xevion/xevion.dev.git
synced 2025-12-13 18:13:42 -06:00
completely remove blur step with plaiceholder
This commit is contained in:
@@ -12,7 +12,6 @@ import { type LinkIcon, LinkIcons } from "../utils/types";
|
|||||||
type ItemCardProps = {
|
type ItemCardProps = {
|
||||||
banner: string;
|
banner: string;
|
||||||
bannerSettings?: { quality: number };
|
bannerSettings?: { quality: number };
|
||||||
bannerBlur: string;
|
|
||||||
title: string;
|
title: string;
|
||||||
description: string;
|
description: string;
|
||||||
links?: LinkIcon[];
|
links?: LinkIcon[];
|
||||||
@@ -21,7 +20,6 @@ type ItemCardProps = {
|
|||||||
|
|
||||||
const ItemCard = ({
|
const ItemCard = ({
|
||||||
banner,
|
banner,
|
||||||
bannerBlur,
|
|
||||||
title,
|
title,
|
||||||
description,
|
description,
|
||||||
links,
|
links,
|
||||||
@@ -64,11 +62,9 @@ const ItemCard = ({
|
|||||||
fill
|
fill
|
||||||
src={banner}
|
src={banner}
|
||||||
quality={bannerSettings?.quality ?? 75}
|
quality={bannerSettings?.quality ?? 75}
|
||||||
blurDataURL={bannerBlur}
|
|
||||||
className={(loaded) =>
|
className={(loaded) =>
|
||||||
classNames("object-cover", loaded ? null : "blur-xl")
|
classNames("object-cover", loaded ? null : "blur-xl")
|
||||||
}
|
}
|
||||||
placeholder="blur"
|
|
||||||
alt={`Banner for ${title}`}
|
alt={`Banner for ${title}`}
|
||||||
/>
|
/>
|
||||||
<div className="elements m-2 grid h-full grid-cols-12 px-1 sm:px-4">
|
<div className="elements m-2 grid h-full grid-cols-12 px-1 sm:px-4">
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ import { readSingleton } from "@directus/sdk";
|
|||||||
import { type NextPage } from "next";
|
import { type NextPage } from "next";
|
||||||
import Head from "next/head";
|
import Head from "next/head";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { getPlaiceholder } from "plaiceholder";
|
|
||||||
import { useEffect } from "react";
|
import { useEffect } from "react";
|
||||||
import Balancer from "react-wrap-balancer";
|
import Balancer from "react-wrap-balancer";
|
||||||
import AppWrapper from "../components/AppWrapper";
|
import AppWrapper from "../components/AppWrapper";
|
||||||
@@ -11,11 +10,9 @@ import directus from "../utils/directus";
|
|||||||
import { useBreakpointValue } from "../utils/helpers";
|
import { useBreakpointValue } from "../utils/helpers";
|
||||||
import type { Project } from "../utils/types";
|
import type { Project } from "../utils/types";
|
||||||
|
|
||||||
type ProjectWithBlur = Project & { bannerBlur: string };
|
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
tagline: string;
|
tagline: string;
|
||||||
projects: ProjectWithBlur[];
|
projects: Project[];
|
||||||
};
|
};
|
||||||
|
|
||||||
export async function getServerSideProps(): Promise<{ props: Props }> {
|
export async function getServerSideProps(): Promise<{ props: Props }> {
|
||||||
@@ -95,17 +92,7 @@ export async function getServerSideProps(): Promise<{ props: Props }> {
|
|||||||
return {
|
return {
|
||||||
props: {
|
props: {
|
||||||
tagline: metadata.tagline,
|
tagline: metadata.tagline,
|
||||||
projects: await Promise.all(
|
projects,
|
||||||
projects.map(async (project) => {
|
|
||||||
const { base64 } = await getPlaiceholder(project.banner, {
|
|
||||||
size: 16,
|
|
||||||
});
|
|
||||||
return {
|
|
||||||
...project,
|
|
||||||
bannerBlur: base64,
|
|
||||||
};
|
|
||||||
})
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user