fix: fixed perf issues
This commit is contained in:
parent
1df0fba292
commit
eb98cc6bd7
|
@ -1,7 +1,7 @@
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { nanoid, customAlphabet } from "nanoid";
|
import { customAlphabet } from "nanoid";
|
||||||
|
|
||||||
const generate = customAlphabet("abcdefghijklmnopqrstuvwxyz", 9);
|
const generate = customAlphabet("abcdefghijklmnopqrstuvwxyz", 9);
|
||||||
|
|
||||||
|
@ -37,7 +37,10 @@ export function Connect() {
|
||||||
className="flex items-center text-primary justify-center"
|
className="flex items-center text-primary justify-center"
|
||||||
href={`mailto:${random_id}@raj.how`}
|
href={`mailto:${random_id}@raj.how`}
|
||||||
>
|
>
|
||||||
<span className="w-[68px] overflow-hidden font-mono tabular-nums text-right">
|
<span
|
||||||
|
suppressHydrationWarning
|
||||||
|
className="w-[68px] overflow-hidden font-mono tabular-nums text-right"
|
||||||
|
>
|
||||||
{random_id}
|
{random_id}
|
||||||
</span>
|
</span>
|
||||||
<span>@raj.how</span>
|
<span>@raj.how</span>
|
||||||
|
|
|
@ -1,13 +1,10 @@
|
||||||
import {
|
import { BackgroundGradentProvider } from "@/components/gradient-provider";
|
||||||
BackgroundGradentProvider,
|
|
||||||
GradientProvider,
|
|
||||||
SymetricGradProvider,
|
|
||||||
} from "@/components/gradient-provider";
|
|
||||||
import GrainProvider from "@/components/grain";
|
import GrainProvider from "@/components/grain";
|
||||||
import { StyledNotion } from "@/components/notion/styled";
|
import { StyledNotion } from "@/components/notion/styled";
|
||||||
import { ExternalLink, Sparkle } from "lucide-react";
|
import { ExternalLink, Sparkle } from "lucide-react";
|
||||||
import { Footer } from "./Footer";
|
import { Footer } from "./Footer";
|
||||||
import { Connect } from "./Connect";
|
import { Connect } from "./Connect";
|
||||||
|
import { motion } from "framer-motion";
|
||||||
|
|
||||||
export default function Page() {
|
export default function Page() {
|
||||||
return (
|
return (
|
||||||
|
@ -91,7 +88,7 @@ function Stories() {
|
||||||
My tech blogs and other writings.
|
My tech blogs and other writings.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<StyledNotion blockId="d149cfb269aa4a5699bbf919a1b0b137" />
|
<StyledNotion className="" blockId="d149cfb269aa4a5699bbf919a1b0b137" />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,12 @@ const Clock: React.FC = () => {
|
||||||
const seconds = time.getSeconds();
|
const seconds = time.getSeconds();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<svg width="18px" height="18px" viewBox="0 0 100 100">
|
<svg
|
||||||
|
suppressHydrationWarning
|
||||||
|
width="18px"
|
||||||
|
height="18px"
|
||||||
|
viewBox="0 0 100 100"
|
||||||
|
>
|
||||||
<circle
|
<circle
|
||||||
cx="50"
|
cx="50"
|
||||||
cy="50"
|
cy="50"
|
||||||
|
@ -41,6 +46,7 @@ const Clock: React.FC = () => {
|
||||||
y1="50"
|
y1="50"
|
||||||
x2="50"
|
x2="50"
|
||||||
y2="20"
|
y2="20"
|
||||||
|
suppressHydrationWarning
|
||||||
transform={calculateRotation(hours, true)}
|
transform={calculateRotation(hours, true)}
|
||||||
stroke="black"
|
stroke="black"
|
||||||
strokeWidth="4"
|
strokeWidth="4"
|
||||||
|
@ -50,6 +56,7 @@ const Clock: React.FC = () => {
|
||||||
y1="50"
|
y1="50"
|
||||||
x2="50"
|
x2="50"
|
||||||
y2="15"
|
y2="15"
|
||||||
|
suppressHydrationWarning
|
||||||
transform={calculateRotation(minutes)}
|
transform={calculateRotation(minutes)}
|
||||||
stroke="black"
|
stroke="black"
|
||||||
strokeWidth="4"
|
strokeWidth="4"
|
||||||
|
@ -59,6 +66,7 @@ const Clock: React.FC = () => {
|
||||||
y1="50"
|
y1="50"
|
||||||
x2="50"
|
x2="50"
|
||||||
y2="10"
|
y2="10"
|
||||||
|
suppressHydrationWarning
|
||||||
transform={calculateRotation(seconds)}
|
transform={calculateRotation(seconds)}
|
||||||
stroke="black"
|
stroke="black"
|
||||||
strokeWidth="2"
|
strokeWidth="2"
|
||||||
|
|
|
@ -60,9 +60,10 @@ export function BackgroundGradentProvider({
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<motion.div
|
<motion.div
|
||||||
|
// blur and fade in
|
||||||
|
initial={{ opacity: 0, filter: "blur(10px)" }}
|
||||||
|
animate={{ opacity: 1, filter: "blur(0px)" }}
|
||||||
className="w-full h-full"
|
className="w-full h-full"
|
||||||
initial={{ opacity: 0 }}
|
|
||||||
animate={{ opacity: 1 }}
|
|
||||||
>
|
>
|
||||||
<Image
|
<Image
|
||||||
className="w-full h-full object-cover"
|
className="w-full h-full object-cover"
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
|
import { motion } from "framer-motion";
|
||||||
import React, { useEffect, useRef, useCallback } from "react";
|
import React, { useEffect, useRef, useCallback } from "react";
|
||||||
|
|
||||||
type GrainOptions = {
|
type GrainOptions = {
|
||||||
|
@ -81,7 +82,10 @@ export const GrainProvider = ({
|
||||||
}, [animate]);
|
}, [animate]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<canvas
|
<motion.canvas
|
||||||
|
initial={{ opacity: 0, filter: "blur(10px)" }}
|
||||||
|
animate={{ opacity: 1, filter: "blur(0px)" }}
|
||||||
|
transition={{ duration: 2 }}
|
||||||
ref={canvasRef}
|
ref={canvasRef}
|
||||||
id="grained-canvas"
|
id="grained-canvas"
|
||||||
className="fixed left-0 top-0 inset-0 z-50 pointer-events-none w-full h-full"
|
className="fixed left-0 top-0 inset-0 z-50 pointer-events-none w-full h-full"
|
||||||
|
|
|
@ -3,6 +3,8 @@ import { type ExtendedRecordMap } from "notion-types";
|
||||||
import dynamic from "next/dynamic";
|
import dynamic from "next/dynamic";
|
||||||
|
|
||||||
import { NotionRenderer } from "react-notion-x";
|
import { NotionRenderer } from "react-notion-x";
|
||||||
|
import { motion } from "framer-motion";
|
||||||
|
import { cn } from "@/lib/utils";
|
||||||
|
|
||||||
const Code = dynamic(() =>
|
const Code = dynamic(() =>
|
||||||
import("react-notion-x/build/third-party/code").then((m) => m.Code),
|
import("react-notion-x/build/third-party/code").then((m) => m.Code),
|
||||||
|
@ -33,7 +35,12 @@ export function NRenderer({
|
||||||
fullPage?: boolean;
|
fullPage?: boolean;
|
||||||
}) {
|
}) {
|
||||||
return (
|
return (
|
||||||
<div className={className}>
|
<motion.div
|
||||||
|
// blur and fade in and animate height to auto
|
||||||
|
initial={{ opacity: 0, filter: "blur(10px)" }}
|
||||||
|
animate={{ opacity: 1, filter: "blur(0px)" }}
|
||||||
|
className={cn("", className)}
|
||||||
|
>
|
||||||
<NotionRenderer
|
<NotionRenderer
|
||||||
components={{
|
components={{
|
||||||
Code,
|
Code,
|
||||||
|
@ -45,6 +52,6 @@ export function NRenderer({
|
||||||
fullPage={fullPage}
|
fullPage={fullPage}
|
||||||
recordMap={recordMap}
|
recordMap={recordMap}
|
||||||
/>
|
/>
|
||||||
</div>
|
</motion.div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue