mirror of
https://github.com/Xevion/xevion.dev.git
synced 2025-12-10 12:09:15 -06:00
Refactor into ItemCard component for upcoming mobile-focus click
This commit is contained in:
31
src/components/ItemCard.tsx
Normal file
31
src/components/ItemCard.tsx
Normal file
@@ -0,0 +1,31 @@
|
||||
import Image from "next/image";
|
||||
import {ArrowLongRightIcon} from "@heroicons/react/24/outline";
|
||||
import React from "react";
|
||||
|
||||
type ItemCardProps = {
|
||||
banner: string;
|
||||
title: React.ReactNode;
|
||||
description: React.ReactNode;
|
||||
}
|
||||
|
||||
const ItemCard = ({banner, title, description}: ItemCardProps) => {
|
||||
return <div className="item">
|
||||
<Image fill src={banner}
|
||||
alt={`Banner for ${title}`}
|
||||
style={{objectFit: "cover"}}
|
||||
/>
|
||||
<div className="elements grid grid-cols-5 h-full">
|
||||
<div className="col-span-4 md:col-span-3 z-30 drop-shadow-2xl p-0 md:p-3 pl-2 md:ml-4">
|
||||
<div className="mt-1 text-xl md:mt-3 md:text-3xl">{title}</div>
|
||||
<div className="mt-0 text-sm md:mt-1.5 md:text-xl ">{description}</div>
|
||||
</div>
|
||||
<div className="hidden md:block"/>
|
||||
<div className="col-span-1 w-full h-full flex align-center justify-center text-zinc-50 pr-10">
|
||||
<ArrowLongRightIcon
|
||||
className="max-w-full stroke-1 text-white z-10 aspect-square w-50"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
export default ItemCard;
|
||||
@@ -1,8 +1,7 @@
|
||||
import {type NextPage} from "next";
|
||||
import Head from "next/head";
|
||||
import Image from "next/image";
|
||||
import {ArrowLongRightIcon} from "@heroicons/react/24/outline";
|
||||
import React from "react";
|
||||
import ItemCard from "../components/ItemCard";
|
||||
|
||||
interface Project {
|
||||
title: string;
|
||||
@@ -42,23 +41,7 @@ const Home: NextPage = () => {
|
||||
<div className="flex h-full m-1 flex-col justify-start gap-y-4">
|
||||
{
|
||||
projects.map((project, index) =>
|
||||
<div key={index} className="item">
|
||||
<Image fill src={project.banner}
|
||||
alt={`Banner for ${project.title}`}
|
||||
style={{objectFit: "cover"}}
|
||||
/>
|
||||
<div className="elements grid grid-cols-5 h-full">
|
||||
<div className="col-span-4 md:col-span-3 z-30 drop-shadow-2xl p-0 md:p-3 pl-2 md:ml-4">
|
||||
<div className="mt-1 text-xl md:mt-3 md:text-3xl">{project.title}</div>
|
||||
<div className="mt-0 text-sm md:mt-1.5 md:text-xl ">{project.description}</div>
|
||||
</div>
|
||||
<div className="hidden md:block"/>
|
||||
<div className="col-span-1 w-full h-full flex align-center justify-center text-zinc-50 pr-10">
|
||||
<ArrowLongRightIcon
|
||||
className="max-w-full stroke-1 text-white z-10 aspect-square w-50"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<ItemCard key={index} {...project} />
|
||||
)
|
||||
}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user