Fix Tampilan Mobile Penghargaan Landing Page

This commit is contained in:
2025-09-25 11:41:43 +08:00
parent d8fa56d923
commit 33fc472472

View File

@@ -6,11 +6,13 @@ import { IconAward, IconArrowRight } from "@tabler/icons-react";
import { useTransitionRouter } from 'next-view-transitions'; import { useTransitionRouter } from 'next-view-transitions';
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import { useProxy } from "valtio/utils"; import { useProxy } from "valtio/utils";
import { useMediaQuery } from "@mantine/hooks";
function Penghargaan() { function Penghargaan() {
const router = useTransitionRouter(); const router = useTransitionRouter();
const state = useProxy(penghargaanState); const state = useProxy(penghargaanState);
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const isMobile = useMediaQuery('(max-width: 768px)');
useEffect(() => { useEffect(() => {
const loadData = async () => { const loadData = async () => {
@@ -24,13 +26,12 @@ function Penghargaan() {
loadData(); loadData();
}, []); }, []);
const data = state.findMany.data?.slice(0, 3); // kalau mobile ambil 1 data aja, kalau desktop ambil 3
const data = state.findMany.data?.slice(0, isMobile ? 1 : 3);
return ( return (
<Stack pos="relative" h={720}> <Stack pos="relative" h="auto" mih={{ base: 500, md: 720 }}>
<video <video
width="320"
height="240"
loop loop
autoPlay autoPlay
muted muted
@@ -38,11 +39,15 @@ function Penghargaan() {
width: "100%", width: "100%",
height: "100%", height: "100%",
objectFit: "cover", objectFit: "cover",
overflow: "hidden", position: "absolute",
top: 0,
left: 0,
zIndex: 0,
}} }}
> >
<source src="/assets/videos/award.mp4" type="video/mp4" /> <source src="/assets/videos/award.mp4" type="video/mp4" />
</video> </video>
<Box <Box
style={{ style={{
width: "100%", width: "100%",
@@ -51,9 +56,10 @@ function Penghargaan() {
top: 0, top: 0,
left: 0, left: 0,
background: "linear-gradient(to bottom, rgba(0,0,0,0.6), rgba(0,0,0,0.85))", background: "linear-gradient(to bottom, rgba(0,0,0,0.6), rgba(0,0,0,0.85))",
zIndex: 1,
}} }}
> >
<Container w={{ base: "100%", md: "80%" }} h={720} p="xl"> <Container w={{ base: "100%", md: "80%" }} mih={{ base: 500, md: 720 }} p="xl">
<Stack justify="center" align="center" gap="xl" h="100%"> <Stack justify="center" align="center" gap="xl" h="100%">
<Text <Text
fw={900} fw={900}