Mobile always uses card view, table only on desktop
On mobile (< sm breakpoint) cards are always rendered regardless of the view toggle. The toggle is already hidden on mobile — this makes the rendering match. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
7152d6b492
commit
1f760e0c65
1 changed files with 29 additions and 22 deletions
33
src/App.tsx
33
src/App.tsx
|
|
@ -179,22 +179,26 @@ export default function App() {
|
||||||
<div className="glass rounded-2xl px-6 py-16 text-center text-slate-600 text-sm">
|
<div className="glass rounded-2xl px-6 py-16 text-center text-slate-600 text-sm">
|
||||||
Loading…
|
Loading…
|
||||||
</div>
|
</div>
|
||||||
) : view === 'grid' ? (
|
) : stores.length === 0 ? (
|
||||||
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-3">
|
<div className="glass rounded-2xl px-6 py-16 text-center text-slate-600 text-sm">
|
||||||
{stores.length === 0 ? (
|
|
||||||
<div className="col-span-full glass rounded-2xl px-6 py-16 text-center text-slate-600 text-sm">
|
|
||||||
No stores found. Try adjusting your filters.
|
No stores found. Try adjusting your filters.
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
stores.map(s => (
|
<>
|
||||||
<StoreCard
|
{/* Mobile: always cards */}
|
||||||
key={s.id}
|
<div className="sm:hidden grid grid-cols-1 gap-3">
|
||||||
store={s}
|
{stores.map(s => (
|
||||||
onEdit={setEditStore}
|
<StoreCard key={s.id} store={s} onEdit={setEditStore} onDelete={setDeleteTarget} />
|
||||||
onDelete={setDeleteTarget}
|
))}
|
||||||
/>
|
</div>
|
||||||
))
|
|
||||||
)}
|
{/* Desktop: toggle between table and grid */}
|
||||||
|
<div className="hidden sm:block">
|
||||||
|
{view === 'grid' ? (
|
||||||
|
<div className="grid sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-3">
|
||||||
|
{stores.map(s => (
|
||||||
|
<StoreCard key={s.id} store={s} onEdit={setEditStore} onDelete={setDeleteTarget} />
|
||||||
|
))}
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<StoreTable
|
<StoreTable
|
||||||
|
|
@ -205,6 +209,9 @@ export default function App() {
|
||||||
onDelete={setDeleteTarget}
|
onDelete={setDeleteTarget}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
|
||||||
{pagination && (
|
{pagination && (
|
||||||
<Pagination
|
<Pagination
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue