styling friday

This commit is contained in:
2025-06-27 12:01:46 -04:00
parent 29c91fee7f
commit 216d10855f
14 changed files with 309 additions and 67 deletions

View File

@@ -0,0 +1,15 @@
import Link from 'next/link'
import React from 'react'
export default function EventInfoQuickView(props: EventProps) {
return (
<Link href={`/events/${props.id}`} >
<div className='hover:cursor-pointer rounded-lg p-2 bg-brand-primary-900 hover:bg-brand-primary-800 transition-colors duration-200'>
<h3 className='text-md font-semibold'>{props.name}</h3>
<p>Date: {props.date ? props.date.toDateString() : 'null'}</p>
<p>Location: {props.location ? props.location : 'null'}</p>
<p className='text-xs mt-2'>Created By: {props.creator.username}</p>
</div>
</Link>
)
}

View File

@@ -13,7 +13,7 @@ interface GuestBookEntry {
notes?: string | null
}
export default function GuestBookList({ entries }: { entries: GuestBookEntry[] }) {
export default function GuestBookList({ entries, view }: { entries: GuestBookEntry[], view: 'TABLE' | 'CARD' }) {
const [editingEntry, setEditingEntry] = useState<GuestBookEntry | null>(null)
function handleModalClose() {
@@ -59,51 +59,57 @@ export default function GuestBookList({ entries }: { entries: GuestBookEntry[] }
return (
<div className='space-y-4'>
<div className='overflow-hidden rounded-xl'>
<table className='table-auto w-full mb-16 p-4'>
<thead className='bg-text text-background'>
<tr className='text-left'>
<th className='px-4 py-2'>Name</th>
<th className='px-4 py-2'>Email</th>
<th className='px-4 py-2'>Phone</th>
<th className='px-4 py-2'>Address</th>
<th className='px-4 py-2'>Notes</th>
</tr>
</thead>
<tbody className=''>
{entries.map(entry => (
<tr
key={entry.id}
className=''
>
<td className='border border-gray-300 px-4 py-2'>{entry.fName + ' ' + entry.lName} <span className='text-sm text-gray-600'>(Side: {entry.side})</span></td>
<td className='border border-gray-300 px-4 py-2'>{entry.email || 'N/A'}</td>
<td className='border border-gray-300 px-4 py-2'>{entry.phone || 'N/A'}</td>
<td className='border border-gray-300 px-4 py-2'>{entry.address || 'N/A'}</td>
<td className='border border-gray-300 px-4 py-2'>{entry.notes || 'N/A'}</td>
{view === 'TABLE' ? (
<div className='overflow-hidden rounded-xl'>
<table className='table-auto w-full mb-16 p-4'>
<thead className='bg-brand-primary text-brand-background border border-brand-primary'>
<tr className='text-left'>
<th className='px-4 py-2'>Name</th>
<th className='px-4 py-2'>Email</th>
<th className='px-4 py-2'>Phone</th>
<th className='px-4 py-2'>Address</th>
<th className='px-4 py-2'>Notes</th>
</tr>
</thead>
<tbody className=''>
{entries.map(entry => (
<tr
key={entry.id}
className='odd:bg-brand-primary-900 even:bg-brand-primary-950 hover:cursor-pointer hover:bg-brand-primary-700 hover:text-brand-background transition-colors duration-50'
onClick={() => setEditingEntry(entry)}
>
<td className='border border-brand-primary px-4 py-2'>{entry.fName + ' ' + entry.lName} <span className='text-sm'>(Side: {entry.side})</span></td>
<td className='border border-brand-primary px-4 py-2'>{entry.email || 'N/A'}</td>
<td className='border border-brand-primary px-4 py-2'>{entry.phone || 'N/A'}</td>
<td className='border border-brand-primary px-4 py-2'>{entry.address || 'N/A'}</td>
<td className='border border-brand-primary px-4 py-2'>{entry.notes || 'N/A'}</td>
</tr>
))}
</tbody>
</table>
</div>
) : (
<div className='space-y-4 mx-auto'>
<div className='grid grid-cols-3 gap-4 w-full'>
{entries.map(entry => (
<div key={entry.id} className='p-4 bg-[#00000008] rounded-lg shadow-sm'>
<h2 className='font-semibold text-lg'>{entry.fName} {entry.lName}</h2>
<p className='text-sm text-brand-primary-400'>Side: {entry.side}</p>
<p>Email: {entry.email || 'N/A'}</p>
<p>Phone: {entry.phone || 'N/A'}</p>
<p>Address: {entry.address || 'N/A'}</p>
<p>Notes: {entry.notes || 'N/A'}</p>
<button
className='text-brand-primary underline text-sm mt-2'
onClick={() => setEditingEntry(entry)}
>
Edit
</button>
</div>
))}
</tbody>
</table>
</div>
<div className='max-w-3xl space-y-4 mx-auto'>
{entries.map(entry => (
<div key={entry.id} className='p-4 border rounded shadow-sm'>
<h2 className='font-semibold text-lg'>{entry.fName} {entry.lName}</h2>
<p className='text-sm text-gray-600'>Side: {entry.side}</p>
<p>Email: {entry.email || 'N/A'}</p>
<p>Phone: {entry.phone || 'N/A'}</p>
<p>Address: {entry.address || 'N/A'}</p>
<p>Notes: {entry.notes || 'N/A'}</p>
<button
className='text-blue-600 underline text-sm mt-2'
onClick={() => setEditingEntry(entry)}
>
Edit
</button>
</div>
))}
</div>
</div>
)}
{editingEntry && (
<EditGuestBookEntryModal

View File

@@ -3,6 +3,8 @@
import { useState } from 'react'
import AddGuestBookEntryModal from '@/components/AddGuestBookEntryModal'
import GuestBookList from '@/components/GuestBookList'
import TableIcon from './icons/TableIcon'
import GuestCardIcon from './icons/GuestCardIcon'
interface GuestBookEntry {
id: string
@@ -16,7 +18,8 @@ interface GuestBookEntry {
}
export default function GuestBookPageClient({ entries }: { entries: GuestBookEntry[] }) {
const [isOpen, setIsOpen] = useState(false)
const [isOpen, setIsOpen] = useState(false);
const [view, setView] = useState<'CARD' | 'TABLE'>('TABLE')
async function handleAddGuest(data: {
fName: string
@@ -48,11 +51,21 @@ export default function GuestBookPageClient({ entries }: { entries: GuestBookEnt
return (
<div className='max-w-6xl mx-auto mt-8 space-y-4'>
<div className="flex justify-between items-center">
<h1 className='text-2xl font-bold'>Guest Book</h1>
<div className='flex gap-5'>
<h1 className='text-2xl font-bold'>Guest Book</h1>
<div className='flex gap-2'>
<button onClick={() => setView('TABLE')}>
<TableIcon />
</button>
<button onClick={() => setView('CARD')}>
<GuestCardIcon />
</button>
</div>
</div>
<button onClick={() => setIsOpen(true)} className="btn btn-primary">Add Guest</button>
</div>
<GuestBookList entries={entries} />
<GuestBookList view={view} entries={entries} />
<AddGuestBookEntryModal
isOpen={isOpen}

View File

@@ -0,0 +1,52 @@
'use client'
import { Transition } from '@headlessui/react';
import React, { Fragment, useState } from 'react'
export default function GuestBookQuickView(props: GuestBookEntry) {
const [isOpen, setIsOpen] = useState<boolean>(false);
const handleOpenView = () => setIsOpen(true);
const handleCloseView = () => setIsOpen(false);
return (
<>
<div
className='p-4 bg-brand-primary-900 rounded-lg hover:cursor-pointer hover:bg-brand-background-950 transition-colors duration-200'
onClick={handleOpenView}
>
<p>{props.fName + " " + props.lName}</p>
<p className='text-xs'>Added on: {new Date(props.createdAt).toDateString()}</p>
</div>
<Transition
as={Fragment}
show={isOpen}
enter="transition duration-200 ease-out"
enterFrom="opacity-0 scale-95"
enterTo="opacity-100 scale-100"
leave="transition duration-150 ease-in"
leaveFrom="opacity-100 scale-100"
leaveTo="opacity-0 scale-95"
>
<div className="absolute right-4 top-4 bg-white border shadow-lg rounded-lg p-6 w-[350px] max-w-full z-30">
<div className="flex justify-between items-center mb-2">
<h2 className="text-lg font-bold">Guest Details</h2>
<button onClick={handleCloseView} className="text-sm text-gray-600 hover:text-red-500">
</button>
</div>
<div className="space-y-2 text-sm">
<p><strong>Name:</strong> {props.fName} {props.lName}</p>
<p><strong>Side:</strong> {props.side}</p>
<p><strong>Email:</strong> {props.email || 'N/A'}</p>
<p><strong>Phone:</strong> {props.phone || 'N/A'}</p>
<p><strong>Address:</strong> {props.address || 'N/A'}</p>
<p><strong>Notes:</strong> {props.notes || 'None'}</p>
<p className='text-xs text-gray-500 pt-2'>Created: {new Date(props.createdAt).toLocaleString()}</p>
</div>
</div>
</Transition>
</>
)
}

View File

@@ -11,7 +11,7 @@ export default function Navbar() {
if (!session?.user) return null
return (
<nav className="flex justify-between items-center p-4 bg-background border-b">
<nav className="flex justify-between items-center p-4 border-b">
<div className="flex items-center space-x-2">
<div className="font-semibold">Wedding Planner</div>
{session.user && (

View File

@@ -0,0 +1,9 @@
import React from 'react'
export default function GuestCardIcon() {
return (
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" className="size-6">
<path fillRule="evenodd" d="M4.5 3.75a3 3 0 0 0-3 3v10.5a3 3 0 0 0 3 3h15a3 3 0 0 0 3-3V6.75a3 3 0 0 0-3-3h-15Zm4.125 3a2.25 2.25 0 1 0 0 4.5 2.25 2.25 0 0 0 0-4.5Zm-3.873 8.703a4.126 4.126 0 0 1 7.746 0 .75.75 0 0 1-.351.92 7.47 7.47 0 0 1-3.522.877 7.47 7.47 0 0 1-3.522-.877.75.75 0 0 1-.351-.92ZM15 8.25a.75.75 0 0 0 0 1.5h3.75a.75.75 0 0 0 0-1.5H15ZM14.25 12a.75.75 0 0 1 .75-.75h3.75a.75.75 0 0 1 0 1.5H15a.75.75 0 0 1-.75-.75Zm.75 2.25a.75.75 0 0 0 0 1.5h3.75a.75.75 0 0 0 0-1.5H15Z" clipRule="evenodd" />
</svg>
)
}

View File

@@ -0,0 +1,9 @@
import React from 'react'
export default function TableIcon() {
return (
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" className="size-6">
<path fillRule="evenodd" d="M1.5 5.625c0-1.036.84-1.875 1.875-1.875h17.25c1.035 0 1.875.84 1.875 1.875v12.75c0 1.035-.84 1.875-1.875 1.875H3.375A1.875 1.875 0 0 1 1.5 18.375V5.625ZM21 9.375A.375.375 0 0 0 20.625 9h-7.5a.375.375 0 0 0-.375.375v1.5c0 .207.168.375.375.375h7.5a.375.375 0 0 0 .375-.375v-1.5Zm0 3.75a.375.375 0 0 0-.375-.375h-7.5a.375.375 0 0 0-.375.375v1.5c0 .207.168.375.375.375h7.5a.375.375 0 0 0 .375-.375v-1.5Zm0 3.75a.375.375 0 0 0-.375-.375h-7.5a.375.375 0 0 0-.375.375v1.5c0 .207.168.375.375.375h7.5a.375.375 0 0 0 .375-.375v-1.5ZM10.875 18.75a.375.375 0 0 0 .375-.375v-1.5a.375.375 0 0 0-.375-.375h-7.5a.375.375 0 0 0-.375.375v1.5c0 .207.168.375.375.375h7.5ZM3.375 15h7.5a.375.375 0 0 0 .375-.375v-1.5a.375.375 0 0 0-.375-.375h-7.5a.375.375 0 0 0-.375.375v1.5c0 .207.168.375.375.375Zm0-3.75h7.5a.375.375 0 0 0 .375-.375v-1.5A.375.375 0 0 0 10.875 9h-7.5A.375.375 0 0 0 3 9.375v1.5c0 .207.168.375.375.375Z" clipRule="evenodd" />
</svg>
)
}