File tree Expand file tree Collapse file tree 2 files changed +19
-5
lines changed
Expand file tree Collapse file tree 2 files changed +19
-5
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ function buildRows(ambassador: Ambassador): InfoCardRow[] {
1818 } ,
1919 {
2020 type : "label" ,
21+ hideInConciseMode : true ,
2122 label :
2223 ambassador . tags . length > 0 ? (
2324 < div className = "flex flex-wrap items-center gap-3" >
@@ -39,14 +40,21 @@ function buildRows(ambassador: Ambassador): InfoCardRow[] {
3940 ]
4041}
4142
42- export function AmbassadorGrid ( { ambassadors } : { ambassadors : Ambassador [ ] } ) {
43+ export function AmbassadorGrid ( {
44+ ambassadors,
45+ concise,
46+ } : {
47+ ambassadors : Ambassador [ ]
48+ concise ?: boolean
49+ } ) {
4350 return (
4451 < div className = "mx-auto mt-10 flex w-full max-w-6xl flex-wrap justify-center gap-8" >
4552 { ambassadors . map ( ( ambassador , index ) => (
4653 < InfoCard
4754 key = { `${ ambassador . label } -${ index } ` }
4855 rows = { buildRows ( ambassador ) }
4956 className = "h-full"
57+ concise = { concise }
5058 />
5159 ) ) }
5260 </ div >
Original file line number Diff line number Diff line change @@ -4,24 +4,28 @@ import { ReactNode } from "react"
44export interface InfoCardLabelRow {
55 type : "label"
66 label : ReactNode
7+ hideInConciseMode ?: boolean
78}
89
910export interface InfoCardTitleRow {
1011 type : "title"
1112 title : ReactNode
13+ hideInConciseMode ?: boolean
1214}
1315
1416export interface InfoCardImageRow {
1517 type : "image"
1618 imageUrl : string
1719 alt ?: string
20+ hideInConciseMode ?: boolean
1821}
1922
2023export type InfoCardRow = InfoCardLabelRow | InfoCardTitleRow | InfoCardImageRow
2124
2225export interface InfoCardProps {
2326 rows : InfoCardRow [ ]
2427 className ?: string
28+ concise ?: boolean
2529}
2630
2731export function InfoCardRow ( { row } : { row : InfoCardRow } ) {
@@ -54,7 +58,7 @@ export function InfoCardRow({ row }: { row: InfoCardRow }) {
5458 }
5559}
5660
57- export function InfoCard ( { rows, className } : InfoCardProps ) {
61+ export function InfoCard ( { rows, concise , className } : InfoCardProps ) {
5862 return (
5963 < div
6064 className = { clsx (
@@ -63,9 +67,11 @@ export function InfoCard({ rows, className }: InfoCardProps) {
6367 ) }
6468 >
6569 < div className = "flex flex-1 flex-col" >
66- { rows . map ( ( row , i ) => (
67- < InfoCardRow key = { i } row = { row } />
68- ) ) }
70+ { rows . map ( ( row , i ) =>
71+ ! concise || ! row . hideInConciseMode ? (
72+ < InfoCardRow key = { i } row = { row } />
73+ ) : null ,
74+ ) }
6975 </ div >
7076 </ div >
7177 )
You can’t perform that action at this time.
0 commit comments