From a00896881b1276862dfa0374c81912408a5883f0 Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Tue, 25 Jul 2023 12:14:24 +0100 Subject: [PATCH] optimising images with next image --- src/app/components/Navbar.tsx | 5 +++-- src/app/components/ProfileDropDown.tsx | 7 +++++-- src/app/components/home/Card.tsx | 11 +++++++++-- src/app/page.tsx | 10 ++++++++-- 4 files changed, 25 insertions(+), 8 deletions(-) diff --git a/src/app/components/Navbar.tsx b/src/app/components/Navbar.tsx index 486d508f..256b75dc 100644 --- a/src/app/components/Navbar.tsx +++ b/src/app/components/Navbar.tsx @@ -32,10 +32,11 @@ function Nav({ userImage }: { userImage: string }) {
- Workflow
diff --git a/src/app/components/ProfileDropDown.tsx b/src/app/components/ProfileDropDown.tsx index 8827e255..d4c9b6fd 100644 --- a/src/app/components/ProfileDropDown.tsx +++ b/src/app/components/ProfileDropDown.tsx @@ -3,16 +3,19 @@ import { Menu } from "@headlessui/react"; import { signOut } from "next-auth/react"; import Link from "next/link"; +import Image from "next/image"; function ProfileDropDown({ userImage }: { userImage: string }) { return ( {userImage ? ( - {"Profile"} ) : ( diff --git a/src/app/components/home/Card.tsx b/src/app/components/home/Card.tsx index e919f54a..660bad6e 100644 --- a/src/app/components/home/Card.tsx +++ b/src/app/components/home/Card.tsx @@ -3,6 +3,7 @@ import StatusBadge from "@/app/components/StatusBadge"; import { useRouter } from "next/navigation"; import { PortfolioStatus } from "@/app/db/schema/portfolio"; import { formatNumber } from "@/app/utils"; +import Image from "next/image"; const styles = { wrapper: @@ -10,7 +11,7 @@ const styles = { header: "relative mt-2 mx-2 border-red", imageWrapper: "h-56 rounded-2xl overflow-hidden flex items-center", wrapperAnime: "transition-all duration-500 ease-in-out", - image: "object-cover w-1/3 mx-auto", + image: "object-cover mx-auto", textWrapper: "pt-6 pb-3 w-full px-4 flex justify-between items-center", }; @@ -39,7 +40,13 @@ const Card = ({ id, title, image, budget, status }: CardProps) => { >
- +
diff --git a/src/app/page.tsx b/src/app/page.tsx index 98abbb4c..845d1019 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -2,7 +2,7 @@ import { getServerSession } from "next-auth/next"; import { AuthOptions } from "./api/auth/[...nextauth]/route"; import GoogleSignInButton from "./components/signin/GoogleSignInButton"; import { redirect } from "next/navigation"; -import Link from "next/link"; +import Image from "next/image"; export default async function Home() { const session = await getServerSession(AuthOptions); @@ -14,7 +14,13 @@ export default async function Home() { return (
- Logo + Logo

Sign in to your account