"use client"
import {useState} from "react";
import { ComponentCaseOne, Maybe } from "@/types/gpl/graphql";
import s from "./index.module.scss";
import Image from "@/modules/common/components/image";
import Button from "@/modules/common/components/button/border";
interface Props {
param: Maybe<ComponentCaseOne> | undefined;
}
export default function SloganOne({ param }: Props) {
const [currentIndex, setCurrentIndex] = useState(0);
return (
<div className={s.contentBox} >
<div className={s.centerBox}>
<div className={s.listBox}>
{
param?.list?.map((item, index) =>
<div className={`${s.item} ${currentIndex === index ? s.active : ""}`} key={index} onMouseEnter={()=>setCurrentIndex(index)}>
<div className={s.imgBox}>
<Image image={item?.cover} sizes="200px" />
</div>
<div className={s.textBox}>
<div className={s.textTitle}>
{item?.title}
</div>
<div className={s.subtitle}>
{item?.desc}
</div>
<div className={s.button}>
<Button text="Learn More" link={`/case/${item?.slug}`} />
</div>
</div>
</div>
)
}
</div>
</div>
</div>
);
}
.contentBox {
padding: 0 var(--content-padding);
.centerBox {
.listBox {
gap: 10px;
margin-bottom: 20px;
@include lg {
margin-bottom: 50px;
display: flex;
}
.item {
cursor: pointer;
position: relative;
height: 400px;
margin-bottom: 10px;
flex: 1;
transition: all .4s ease-in-out;
@include md {}
@include lg {
margin-bottom: 0;
height: 600px;
}
.imgBox {
height: 100%;
}
.textBox {
position: absolute;
left: 50%;
bottom: 0;
transform: translateX(-50%);
padding: 20px;
width: 100%;
background-color: rgba(0, 0, 0, .5);
color: #fff;
@include lg {
padding-left: 50px;
}
.textTitle {
font-size: var(--font-lg);
white-space: pre-line;
margin-bottom: 10px;
}
.subtitle {
margin-bottom: 20px;
}
}
}
.item:hover {
flex: 3;
}
}
.buttonBox {
display: flex;
justify-content: center;
}
}
}