소스 검색

Size vehicle grid rows to their cards so photos are not squeezed into strips (#342)

Bernt Christian Egeland 3 주 전
부모
커밋
98bec6bea2
1개의 변경된 파일과 8개의 추가작업 그리고 3개의 파일을 삭제
  1. 8 3
      src/app/(authenticated)/vehicles/vehicles-client.tsx

+ 8 - 3
src/app/(authenticated)/vehicles/vehicles-client.tsx

@@ -723,7 +723,7 @@ export function VehiclesClient({
       ) : isPending ? (
       ) : isPending ? (
         /* Grid skeleton */
         /* Grid skeleton */
         <div
         <div
-          className={`-m-1 grid min-h-0 flex-1 content-start gap-4 overflow-y-auto p-1 sm:grid-cols-2 lg:grid-cols-3 ${view === 'grid6' ? 'xl:grid-cols-4 2xl:grid-cols-6' : 'xl:grid-cols-4'}`}
+          className={`-m-1 grid min-h-0 flex-1 auto-rows-max content-start gap-4 overflow-y-auto p-1 sm:grid-cols-2 lg:grid-cols-3 ${view === 'grid6' ? 'xl:grid-cols-4 2xl:grid-cols-6' : 'xl:grid-cols-4'}`}
         >
         >
           {Array.from({ length: view === 'grid6' ? 12 : 6 }).map((_, i) => (
           {Array.from({ length: view === 'grid6' ? 12 : 6 }).map((_, i) => (
             <Card key={i} className="overflow-hidden border-0 py-0 gap-0 shadow-sm">
             <Card key={i} className="overflow-hidden border-0 py-0 gap-0 shadow-sm">
@@ -736,9 +736,14 @@ export function VehiclesClient({
           ))}
           ))}
         </div>
         </div>
       ) : (
       ) : (
-        /* Grid view */
+        /* Grid view. Rows are sized to their content explicitly: the cards
+           clip their hover zoom with overflow-hidden, which makes each one
+           a scroll container whose minimum height is zero, so auto rows in
+           this fixed-height list would split its height evenly between
+           every row on the page instead. On a phone that was one thin
+           strip per vehicle; on a desktop the title was clipped away. */
         <div
         <div
-          className={`-m-1 grid min-h-0 flex-1 content-start gap-4 overflow-y-auto p-1 sm:grid-cols-2 lg:grid-cols-3 ${view === 'grid6' ? 'xl:grid-cols-4 2xl:grid-cols-6' : 'xl:grid-cols-4'}`}
+          className={`-m-1 grid min-h-0 flex-1 auto-rows-max content-start gap-4 overflow-y-auto p-1 sm:grid-cols-2 lg:grid-cols-3 ${view === 'grid6' ? 'xl:grid-cols-4 2xl:grid-cols-6' : 'xl:grid-cols-4'}`}
         >
         >
           {data.vehicles.map((v) => (
           {data.vehicles.map((v) => (
             <ContextMenu key={v.id} modal={false}>
             <ContextMenu key={v.id} modal={false}>