This commit is contained in:
Ilgeldi 2025-02-18 15:47:56 +05:00
parent 40546c8a3d
commit 15ac1ca1c7
3 changed files with 23 additions and 7 deletions

View File

@ -1,5 +1,5 @@
import Image from 'next/image'; import Image from "next/image";
import InfoDateAllert from '../common/InfoDateAllert'; import InfoDateAllert from "../common/InfoDateAllert";
interface LotteryHeaderProps { interface LotteryHeaderProps {
title: string; title: string;
@ -9,7 +9,13 @@ interface LotteryHeaderProps {
startDate: string; startDate: string;
} }
const LotteryHeader = ({ title, description, image, smsCode, startDate }: LotteryHeaderProps) => { const LotteryHeader = ({
title,
description,
image,
smsCode,
startDate,
}: LotteryHeaderProps) => {
return ( return (
<section className="container"> <section className="container">
<div className="flex flex-col md:gap-[32px] gap-[24px]"> <div className="flex flex-col md:gap-[32px] gap-[24px]">
@ -17,7 +23,9 @@ const LotteryHeader = ({ title, description, image, smsCode, startDate }: Lotter
<h1 className="sm:font-display-1-regular text-[32px] leading-[40px] text-center"> <h1 className="sm:font-display-1-regular text-[32px] leading-[40px] text-center">
{title} {title}
</h1> </h1>
<p className="text-center text-textLarge leading-textLarge">{description}</p> <p className="text-center text-textLarge leading-textLarge">
{description}
</p>
<InfoDateAllert date={startDate} text="Senesi:" /> <InfoDateAllert date={startDate} text="Senesi:" />
</div> </div>
{image && ( {image && (
@ -27,7 +35,7 @@ const LotteryHeader = ({ title, description, image, smsCode, startDate }: Lotter
width={1416} width={1416}
height={177} height={177}
alt="banner" alt="banner"
className="rounded-[12px] h-[177px] md:object-cover" className="rounded-[12px] h-[177px] object-cover"
/> />
</div> </div>
)} )}

View File

@ -8,10 +8,12 @@ import { useRouter } from "next/navigation";
import { getLotteryStatus } from "@/lib/actions"; import { getLotteryStatus } from "@/lib/actions";
import LotteryWinners from "./LotteryWinners"; import LotteryWinners from "./LotteryWinners";
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import { useMediaQuery } from "usehooks-ts";
const LotteryMain = () => { const LotteryMain = () => {
const [lotteryData, setLotteryData] = useState<any>(); const [lotteryData, setLotteryData] = useState<any>();
const router = useRouter(); const router = useRouter();
const mobile = useMediaQuery("(max-width: 768px)");
useEffect(() => { useEffect(() => {
async function getData() { async function getData() {
@ -45,7 +47,9 @@ const LotteryMain = () => {
<LotteryHeader <LotteryHeader
title={lotteryData?.data.title} title={lotteryData?.data.title}
description={lotteryData?.data.description} description={lotteryData?.data.description}
image={lotteryData?.data.image} image={
mobile ? lotteryData?.data.image_mobile : lotteryData?.data.image
}
smsCode={lotteryData?.data.sms_code} smsCode={lotteryData?.data.sms_code}
startDate={lotteryData?.data.start_time} startDate={lotteryData?.data.start_time}
/> />

View File

@ -6,9 +6,11 @@ import { getTossData } from "@/api/queries";
import { getLotteryStatus } from "@/lib/actions"; import { getLotteryStatus } from "@/lib/actions";
import LotteryWinners from "../lottery/LotteryWinners"; import LotteryWinners from "../lottery/LotteryWinners";
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import { useMediaQuery } from "usehooks-ts";
const TossPage = ({ type, id }: { type: "bije" | "cekilis"; id: string }) => { const TossPage = ({ type, id }: { type: "bije" | "cekilis"; id: string }) => {
const [tossData, setTossData] = useState<any>(); const [tossData, setTossData] = useState<any>();
const mobile = useMediaQuery("(max-width: 768px)");
useEffect(() => { useEffect(() => {
const getData = async () => { const getData = async () => {
@ -32,7 +34,9 @@ const TossPage = ({ type, id }: { type: "bije" | "cekilis"; id: string }) => {
<LotteryHeader <LotteryHeader
title={tossData.data.title} title={tossData.data.title}
description={tossData.data.description} description={tossData.data.description}
image={tossData.data.image} image={
mobile ? tossData?.data.image_mobile : tossData?.data.image
}
smsCode={tossData.data.sms_code} smsCode={tossData.data.sms_code}
startDate={tossData.data.start_time} startDate={tossData.data.start_time}
/> />