Responsive design for Sender-page
This commit is contained in:
1 parent
998434e4eb
commit
c71df05598
5 files changed
+36
-64
No files matched your search
@@ -56,86 +56,57 @@ function Songs({ actionName, onSelectSong, songBooks, className = "", ...props }
|
||||
.filter((g) => g.songs.length > 0);
|
||||
}, [books, query]);
|
||||
|
||||
const th = "p-3 text-xs font-semibold text-neutral-600 dark:text-neutral-400 uppercase tracking-wider";
|
||||
|
||||
return (
|
||||
<Card
|
||||
{...props}
|
||||
title="Alle Lieder"
|
||||
className={`h-[500px] ${className}`}
|
||||
>
|
||||
<div className="mb-4">
|
||||
<Card {...props} title="Alle Lieder" className={className}>
|
||||
<div className="mb-3">
|
||||
<Input.Text
|
||||
type="text"
|
||||
placeholder="Nach Songtitel, Nummer oder Liederbuch suchen..."
|
||||
placeholder="Titel, Nummer oder Liederbuch suchen..."
|
||||
value={query}
|
||||
onChange={(e) => setQuery(e.target.value)}
|
||||
/>
|
||||
</div>
|
||||
<div className="flex-1 min-h-0 overflow-auto border border-neutral-200 dark:border-neutral-800 rounded-lg bg-white dark:bg-black">
|
||||
<table className="w-full text-left border-collapse text-sm">
|
||||
<thead className="bg-neutral-100 dark:bg-neutral-900 sticky top-0 border-b border-neutral-200 dark:border-neutral-800 z-10">
|
||||
<tr>
|
||||
<th className={`${th} w-24 text-center`}>Nummer</th>
|
||||
<th className={th}>Titel</th>
|
||||
<th className={`${th} text-right`}>Aktion</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<div className="max-h-[65vh] overflow-y-auto border border-neutral-200 dark:border-neutral-800 rounded-lg bg-white dark:bg-black">
|
||||
{groups.length === 0 ? (
|
||||
<tbody>
|
||||
<tr>
|
||||
<td colSpan={3} className="p-8 text-center text-neutral-400 dark:text-neutral-500">
|
||||
<p className="p-8 text-center text-neutral-400 dark:text-neutral-500">
|
||||
Keine Lieder gefunden
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</p>
|
||||
) : (
|
||||
groups.map(({ book, songs }) => (
|
||||
<tbody key={book.id} className="divide-y divide-neutral-200 dark:divide-neutral-800">
|
||||
<tr className="bg-neutral-50 dark:bg-neutral-950">
|
||||
<th
|
||||
colSpan={3}
|
||||
className="p-3 text-sm font-bold text-neutral-900 dark:text-white border-y border-neutral-200 dark:border-neutral-800"
|
||||
>
|
||||
<section key={book.id}>
|
||||
<h3 className="sticky top-0 z-10 px-3 py-2 text-sm font-bold bg-neutral-100 dark:bg-neutral-900 text-neutral-900 dark:text-white border-y border-neutral-200 dark:border-neutral-800">
|
||||
{book.title}
|
||||
{book.language && (
|
||||
<span className="ml-2 text-xs font-normal text-neutral-500 dark:text-neutral-400">
|
||||
<span className="ml-2 text-xs font-normal text-neutral-500">
|
||||
({book.language})
|
||||
</span>
|
||||
)}
|
||||
</th>
|
||||
</tr>
|
||||
</h3>
|
||||
<ul className="divide-y divide-neutral-200 dark:divide-neutral-800">
|
||||
{songs.map((entry) => (
|
||||
<tr
|
||||
<li
|
||||
key={`${book.id}-${entry.song.id}`}
|
||||
className="hover:bg-neutral-100/60 dark:hover:bg-neutral-900/40 transition"
|
||||
className="flex flex-wrap items-center gap-x-3 gap-y-2 px-3 py-2.5"
|
||||
>
|
||||
<td className="p-3 text-center font-mono text-blue-600 dark:text-blue-400 font-bold">
|
||||
<span className="w-12 shrink-0 text-center font-mono font-bold text-blue-600 dark:text-blue-400">
|
||||
{entry.songNumber}
|
||||
</td>
|
||||
<td className="p-3 font-medium text-neutral-900 dark:text-white">
|
||||
</span>
|
||||
<span className="flex-1 min-w-40 break-words font-medium text-neutral-900 dark:text-white">
|
||||
{entry.song.title}
|
||||
</td>
|
||||
<td className="p-3 text-right">
|
||||
</span>
|
||||
<Input.Button
|
||||
onClick={() =>
|
||||
onSelectSong?.(
|
||||
entry.song,
|
||||
{ id: book.id, title: book.title },
|
||||
String(entry.songNumber)
|
||||
)
|
||||
}
|
||||
className="bg-white dark:bg-black hover:bg-blue-600 dark:hover:bg-blue-600 border border-neutral-300 dark:border-neutral-700 hover:border-blue-600 dark:hover:border-blue-500 hover:text-white font-medium rounded-md px-3 py-1.5 transition text-xs"
|
||||
onClick={() => onSelectSong?.(entry.song, { id: book.id, title: book.title }, String(entry.songNumber))}
|
||||
className="shrink-0 w-auto px-3 py-2 text-xs"
|
||||
>
|
||||
{actionName}
|
||||
</Input.Button>
|
||||
</td>
|
||||
</tr>
|
||||
</li>
|
||||
))}
|
||||
</tbody>
|
||||
</ul>
|
||||
</section>
|
||||
))
|
||||
)}
|
||||
</table>
|
||||
</div>
|
||||
</Card>
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user