feat: enhance Newsletter component with props

This commit is contained in:
Ardeman 2025-02-27 19:40:31 +08:00
commit 16a6a14d67
6 changed files with 86 additions and 34 deletions

View File

@ -4,7 +4,7 @@ import { APP } from '~/configs/meta'
export const Banner = () => {
return (
<div className="min-h-[65px] sm:mx-10">
<div className="min-h-[65px] lg:mx-10">
<div className="relative">
<Link
to="/#"
@ -13,7 +13,7 @@ export const Banner = () => {
<img
src={'/images/banner.png'}
alt={APP.title}
className="h-[70px] w-[100%] sm:h-full"
className="h-[70px] w-[100%] content-center sm:h-full"
/>
</Link>
</div>

View File

@ -1,24 +1,43 @@
import { twMerge } from 'tailwind-merge'
import { Button } from '~/components/ui/button'
export const Newsletter = () => {
type NewsletterProperties = {
className?: string
title?: string
description?: string
textButton?: string
onClick?: () => void
}
export const Newsletter = (property: NewsletterProperties) => {
const { className, title, description } = property
return (
<div className="flex h-[300px] w-full flex-col md:flex-row">
<div className="flex w-full flex-col justify-center gap-5 bg-[#2E2F7C] px-6 py-5 text-white sm:px-30 md:w-[50%]">
<h2 className="text-2xl font-bold sm:text-4xl">Join Our Newsletter</h2>
<div className="relative">
<div
className={`absolute flex h-[400px] w-screen flex-col sm:h-[300px] md:flex-row ${twMerge('', className)}`}
>
<div className="flex h-1/2 w-full flex-col justify-center gap-5 bg-[#2E2F7C] px-6 py-5 text-white sm:h-full sm:w-[50%] sm:px-30">
<h2 className="text-2xl font-bold sm:text-4xl">
{title ? `${title}` : 'Join Our Newsletter'}
</h2>
<p className="text:md sm:text-lg">
Tidak ingin ketinggalan Berita Hukum terhangat? Ingin mendapat
informasi kajian dan networking terbaru? Ikuti Newsletter kami dan
Stay up to Speed!
{description
? `${description}`
: `Tidak ingin ketinggalan Berita Hukum terhangat?
Ingin mendapat informasi kajian dan networking terbaru?
Ikuti Newsletter kami dan Stay up to Speed!`}
</p>
</div>
<div
className="flex flex-col justify-center bg-cover bg-center px-20 py-5 sm:w-full md:w-[50%]"
style={{
backgroundImage: "url('https://placehold.co/400x300.png')",
backgroundImage: "url('/images/bg-newsletter.png')",
backgroundSize: 'cover',
backgroundPosition: 'center',
}}
className="flex h-1/2 w-full flex-col items-center justify-center text-center sm:h-full sm:w-[50%]"
>
<form className="grid gap-5">
<form className="grid w-[50%] gap-5">
<input
type="email"
placeholder="Daftarkan Email Disini"
@ -34,5 +53,6 @@ export const Newsletter = () => {
</form>
</div>
</div>
</div>
)
}

View File

@ -1,6 +1,8 @@
import { Field, Input, Label, Select } from '@headlessui/react'
import DT from 'datatables.net-dt'
import DataTable from 'datatables.net-react'
import { SearchIcon } from '~/components/icons/search'
import { TitleDashboard } from '~/components/ui/title-dashboard'
import { CONTENTS } from './data'
@ -34,6 +36,34 @@ export const ContentsPage = () => {
return (
<div className="relative">
<TitleDashboard title="Konten" />
<div className="mb-8 flex items-center gap-5 rounded-lg bg-gray-50 text-[#363636]">
<div className="w-[400px]">
<Field>
<Label className="mb-2 block text-sm font-medium">Cari User</Label>
<div className="relative">
<Input
type="text"
placeholder="Cari Nama"
className="w-full rounded-lg bg-white p-2 pr-10 pl-4 shadow focus:ring-1 focus:ring-[#2E2F7C] focus:outline-none"
/>
<div className="absolute inset-y-0 right-0 flex items-center pr-3">
<SearchIcon className="h-5 w-5" />
</div>
</div>
</Field>
</div>
<div className="w-[235px]">
<Field>
<Label className="mb-2 block text-sm font-medium">Status</Label>
<Select className="w-full rounded-lg bg-white p-2 shadow focus:ring-1 focus:ring-[#2E2F7C] focus:outline-none">
<option>Pilih Status</option>
<option>Aktif</option>
<option>Nonaktif</option>
</Select>
</Field>
</div>
</div>
<div className="rounded-lg bg-white p-6 shadow-md">
<h3 className="py-1 font-semibold text-[#4C5CA0]">Daftar Content</h3>
<DataTable

View File

@ -44,7 +44,7 @@ export const SubscriptionsPage = () => {
},
]
const switchViee = () => {
const switchView = () => {
setSubscribtionOpen(!SubscribtionOpen)
}
@ -53,7 +53,7 @@ export const SubscriptionsPage = () => {
<TitleDashboard title="Subscription" />
<Button
className="float-right mt-7 h-10 w-[160px] rounded-md"
onClick={switchViee}
onClick={switchView}
>
{SubscribtionOpen ? 'Subscriptions' : 'Save'}
</Button>

View File

@ -10,7 +10,9 @@ export const NewsPage = () => {
<Card>
<Carousel {...SPOTLIGHT} />
</Card>
<Newsletter />
<div className="min-h-[400px] sm:min-h-[300px]">
<Newsletter className="mr-0 lg:-ml-14" />
</div>
<Card>
<Carousel {...BERITA} />
</Card>

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 MiB