Skip to content

Commit 1db69f0

Browse files
committed
secondary label for external link
1 parent d6fb126 commit 1db69f0

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

packages/synapse-react-client/src/components/CardContainerLogic/CardContainerLogic.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,14 @@ export type CommonCardProps = {
142142
rgbIndex?: number
143143
columnIconOptions?: ColumnIconConfigs
144144
releaseCardConfig?: ReleaseCardConfig
145+
customSecondaryLabelConfig?: {
146+
key: string
147+
value: string
148+
isVisible: (
149+
schema: Record<string, number>,
150+
data: string[],
151+
) => string | undefined
152+
}
145153
}
146154
export type CardConfiguration = {
147155
type: string

packages/synapse-react-client/src/components/GenericCard/GenericCard.tsx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,20 @@ class _GenericCard extends Component<GenericCardPropsInternal> {
407407
)
408408
const values: string[][] = []
409409
const { secondaryLabels = [] } = genericCardSchemaDefined
410+
const howToDownloadSecondaryLabelConfig = {
411+
key: 'HOW TO DOWNLOAD',
412+
value: 'This file is hosted externally, follow the External Link, below',
413+
isVisible: (schema: Record<string, number>, data: string[]) => {
414+
return data[schema['externalLink']]
415+
? [
416+
howToDownloadSecondaryLabelConfig.key,
417+
howToDownloadSecondaryLabelConfig.value,
418+
'externalLink',
419+
]
420+
: undefined
421+
},
422+
}
423+
410424
const isView = table && !isTableEntity(table)
411425
for (let i = 0; i < secondaryLabels.length; i += 1) {
412426
const columnName = secondaryLabels[i]
@@ -443,6 +457,11 @@ class _GenericCard extends Component<GenericCardPropsInternal> {
443457
)
444458
columnDisplayName = getColumnDisplayName(columnName)
445459
}
460+
if (columnName === 'externalLink') {
461+
values.push(
462+
howToDownloadSecondaryLabelConfig.isVisible(schema, data) || [],
463+
)
464+
}
446465
const keyValue = [columnDisplayName, value, columnName]
447466
values.push(keyValue)
448467
}

0 commit comments

Comments
 (0)