style: slicing home page, adjust for mobile view

slicing home page, adjust for mobile view
This commit is contained in:
fredy.siswanto
2025-02-20 01:37:35 +07:00
parent fe441ad5ac
commit f17627bdf2
13 changed files with 412 additions and 128 deletions
+13 -11
View File
@@ -6,20 +6,22 @@ import { COPYRIGHT_MENU, FOOTER_MENU } from './menu'
export const FooterLinks = () => {
return (
<div className="col-span-3 flex flex-col justify-between">
<div className="grid grid-cols-3 gap-4">
<div className="col-span-1 flex flex-col justify-between sm:col-span-3">
<div className="grid grid-cols-1 gap-4 sm:grid-cols-3">
{FOOTER_MENU.map(({ group, items }, index) => (
<div
key={index}
className="flex flex-col gap-3"
className="flex w-full flex-col gap-3"
>
<h3 className="text-2xl font-semibold">{group}</h3>
<div>
<h3 className="text-xl font-semibold sm:text-2xl">{group}</h3>
<div
className={`${group === 'Follow Us' ? 'flex-col-2 flex w-full flex-wrap' : ''}`}
>
{items.map(({ url, icon: Icon, title }, subIndex) => (
<Link
key={subIndex}
to={url}
className="flex items-center gap-3 py-2"
className="flex w-1/2 items-center gap-3 py-1 sm:w-full"
>
{Icon && (
<Icon
@@ -35,21 +37,21 @@ export const FooterLinks = () => {
</div>
))}
</div>
<div className="flex justify-between border-t border-white pt-8 text-sm">
<div>
{new Date().getFullYear()} {APP.title}. All rights reserved.
</div>
<div className="mt-8 justify-between border-t border-white pt-8 text-center text-xs sm:flex sm:text-sm">
<div className="flex gap-6">
{COPYRIGHT_MENU.map(({ url, title }, index) => (
<Link
key={index}
to={url}
className="text-white underline"
className={`w-full text-white underline`}
>
{title}
</Link>
))}
</div>
<div className="mt-2 sm:order-first">
{new Date().getFullYear()} {APP.title}. All rights reserved.
</div>
</div>
</div>
)
+49 -32
View File
@@ -5,39 +5,56 @@ import { APP } from '~/data/meta'
export const FooterNewsletter = () => {
return (
<div className="col-span-2 grid gap-y-6">
<div className="h-[75px] bg-white p-3">
<Link
to="/news"
className="h-full"
>
<img
src={APP.logo}
alt={APP.title}
className="h-full w-auto"
<>
<div className="col-span-2 hidden gap-y-6 sm:grid">
<div className="h-[75px] bg-white p-3">
<Link
to="/news"
className="h-full"
>
<img
src={APP.logo}
alt={APP.title}
className="h-full w-auto"
/>
</Link>
</div>
<h2 className="text-4xl font-bold">Join Our Newsletter</h2>
<p className="text-lg">
Tidak ingin ketinggalan Berita Hukum terhangat? ingin mendapat
informasi kajian dan networking terbaru? ikuti Newsletter kami and
Stay up to Speed!
</p>
<form className="grid gap-5">
<input
placeholder="Daftarkan Email Disini"
className="h-[50px] flex-1 bg-white text-center text-lg font-light text-black placeholder:text-[#777777] focus:ring-0 focus:outline-none"
size={1}
/>
</Link>
<Button
type="submit"
variant="newsPrimaryOutline"
size="block"
>
Subscribe
</Button>
</form>
</div>
<h2 className="text-4xl font-bold">Join Our Newsletter</h2>
<p className="text-lg">
Tidak ingin ketinggalan Berita Hukum terhangat? ingin mendapat informasi
kajian dan networking terbaru? ikuti Newsletter kami and Stay up to
Speed!
</p>
<form className="grid gap-5">
<input
placeholder="Daftarkan Email Disini"
className="h-[50px] flex-1 bg-white text-center text-lg font-light text-black placeholder:text-[#777777] focus:ring-0 focus:outline-none"
size={1}
/>
<Button
type="submit"
variant="newsPrimaryOutline"
size="block"
>
Subscribe
</Button>
</form>
</div>
<div className="block sm:hidden">
<div className="h-[60px] bg-white p-3">
<Link
to="/news"
className="h-full"
>
<img
src={APP.logo}
alt={APP.title}
className="h-full w-auto"
/>
</Link>
</div>
</div>
</>
)
}
+88
View File
@@ -0,0 +1,88 @@
import { useState } from 'react'
import { Link } from 'react-router'
import { HeaderSearch } from '~/layouts/header-search'
import { MENU } from './menu'
export default function HeaderMenuMobile() {
const [isMenuOpen, setIsMenuOpen] = useState(false)
const handleToggleMenu = (): void => {
setIsMenuOpen(!isMenuOpen)
}
return (
<>
<div className="relative z-50 flex min-h-[65px] bg-[#2E2F7C] font-[sans-serif] tracking-wide text-white sm:hidden sm:px-10">
<div className="mx-auto flex w-full max-w-screen-xl flex-wrap items-center gap-4 align-middle">
{/* Menu */}
<div
className={`z-50 transition-transform duration-300 max-lg:fixed max-lg:top-0 max-lg:left-0 max-lg:h-full max-lg:w-full max-lg:overflow-auto max-lg:bg-[#2E2F7C] max-lg:p-6 max-lg:shadow-md ${
isMenuOpen ? 'translate-x-0' : '-translate-x-full'
}`}
>
{/* Tombol Close */}
<button
onClick={handleToggleMenu}
className="fixed top-2 right-4 z-[100] flex h-9 w-9 items-center justify-center lg:hidden"
>
<svg
xmlns="http://www.w3.org/2000/svg"
className="h-3.5 w-3.5 fill-white"
viewBox="0 0 320.591 320.591"
>
<path d="M30.391 318.583a30.37 30.37 0 0 1-21.56-7.288c-11.774-11.844-11.774-30.973 0-42.817L266.643 10.665c12.246-11.459 31.462-10.822 42.921 1.424 10.362 11.074 10.966 28.095 1.414 39.875L51.647 311.295a30.366 30.366 0 0 1-21.256 7.288z" />
<path d="M287.9 318.583a30.37 30.37 0 0 1-21.257-8.806L8.83 51.963C-2.078 39.225-.595 20.055 12.143 9.146c11.369-9.736 28.136-9.736 39.504 0l259.331 257.813c12.243 11.462 12.876 30.679 1.414 42.922-.456.487-.927.958-1.414 1.414a30.368 30.368 0 0 1-23.078 7.288z" />
</svg>
</button>
{/* List Menu */}
<ul className="mx-10 max-lg:space-y-3 lg:ml-14 lg:flex lg:gap-x-5">
{MENU.map((item) => (
<li className="px-3 max-lg:border-b max-lg:py-3">
<Link
key={item.title}
to={item.url}
className={
'flex h-full items-center justify-center border-white px-[35px] sm:border-r'
}
>
{item.title}
</Link>
</li>
))}
<button className="w-full bg-white px-[35px] py-3 text-center text-[#2E2F7C] sm:hidden">
Akun
</button>
</ul>
</div>
{/* Search dan Toggle Button */}
<div className="align-center flex w-full justify-center">
<button
onClick={handleToggleMenu}
className="h-[63px] border border-white px-4 lg:hidden"
>
<svg
className="h-7 w-7"
fill="#fff"
viewBox="0 0 20 20"
xmlns="http://www.w3.org/2000/svg"
>
<path
fillRule="evenodd"
d="M3 5a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM3 10a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM3 15a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1z"
clipRule="evenodd"
/>
</svg>
</button>
<div className="w-full py-3">
<HeaderSearch></HeaderSearch>
</div>
</div>
</div>
</div>
</>
)
}
+19 -14
View File
@@ -1,23 +1,28 @@
import { Link } from 'react-router'
import HeaderMenuMobile from '~/layouts/header-menu-mobile'
import { HeaderSearch } from './header-search'
import { MENU } from './menu'
export const HeaderMenu = () => {
return (
<div className="flex h-[60px] items-center justify-between bg-[#2E2F7C] text-xl font-medium text-white">
{MENU.map((item) => (
<Link
key={item.title}
to={item.url}
className={
'flex h-full items-center justify-center border-r border-white px-[35px]'
}
>
{item.title}
</Link>
))}
<HeaderSearch />
</div>
<>
<div className="hidden h-[60px] items-center justify-between bg-[#2E2F7C] text-xl font-medium text-white sm:flex">
{MENU.map((item) => (
<Link
key={item.title}
to={item.url}
className={
'flex h-full items-center justify-center border-r border-white px-[35px]'
}
>
{item.title}
</Link>
))}
<HeaderSearch />
</div>
<HeaderMenuMobile />
</>
)
}
+2 -2
View File
@@ -6,14 +6,14 @@ export const HeaderSearch = () => {
<form className="flex flex-1 justify-between gap-[15px] px-[35px]">
<input
placeholder="Cari..."
className="flex-1 placeholder:text-white focus:ring-0 focus:outline-none"
className="flex-1 text-xl placeholder:text-white focus:ring-0 focus:outline-none sm:text-2xl"
size={1}
/>
<Button
type="submit"
variant="icon"
size="icon"
className="[&_svg]:size-[30px]"
className="[&_svg]:size-[20px] sm:[&_svg]:size-[30px]"
>
<SearchIcon />
</Button>
+14 -7
View File
@@ -5,24 +5,31 @@ import { APP } from '~/data/meta'
export const HeaderTop = () => {
return (
<div className="flex h-[100px] items-center justify-between gap-[15px] bg-white px-[50px] py-[20px]">
<div className="flex h-[60px] items-center justify-between bg-white px-5 align-middle sm:h-[100px] sm:gap-[15px] sm:px-[50px] sm:py-[20px]">
<Link
to="/news"
className="h-full py-[5px]"
className="mt-2 h-full py-2"
>
<img
src={APP.logo}
alt={APP.title}
className="h-full w-auto"
className="h-3/4 w-auto sm:h-full"
/>
</Link>
<div className="flex h-full items-center py-1.5 font-light whitespace-pre-line">
<div className="hidden h-full items-center py-1.5 font-light whitespace-pre-line sm:flex">
{APP.description}
</div>
<div className="flex items-center gap-[15px]">
<Button>About Us</Button>
<Button variant="newsSecondary">Akun</Button>
<div className="w-[60px]">
<Button className="h-8 w-auto rounded-none px-3 text-xs sm:h-[50px] sm:w-[150px] sm:text-lg">
About Us
</Button>
<Button
variant="newsSecondary"
className="hidden sm:block"
>
Akun
</Button>
<div className="w-[50px] sm:w-[60px]">
<img
alt="language"
src="/flags/id.svg"