Skip to content

Commit

Permalink
secondary label for external link
Browse files Browse the repository at this point in the history
  • Loading branch information
kianamcc committed Mar 6, 2025
1 parent d6fb126 commit 1db69f0
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,14 @@ export type CommonCardProps = {
rgbIndex?: number
columnIconOptions?: ColumnIconConfigs
releaseCardConfig?: ReleaseCardConfig
customSecondaryLabelConfig?: {
key: string
value: string
isVisible: (
schema: Record<string, number>,
data: string[],
) => string | undefined
}
}
export type CardConfiguration = {
type: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,20 @@ class _GenericCard extends Component<GenericCardPropsInternal> {
)
const values: string[][] = []
const { secondaryLabels = [] } = genericCardSchemaDefined
const howToDownloadSecondaryLabelConfig = {
key: 'HOW TO DOWNLOAD',
value: 'This file is hosted externally, follow the External Link, below',
isVisible: (schema: Record<string, number>, data: string[]) => {
return data[schema['externalLink']]
? [
howToDownloadSecondaryLabelConfig.key,
howToDownloadSecondaryLabelConfig.value,
'externalLink',
]
: undefined
},
}

const isView = table && !isTableEntity(table)
for (let i = 0; i < secondaryLabels.length; i += 1) {
const columnName = secondaryLabels[i]
Expand Down Expand Up @@ -443,6 +457,11 @@ class _GenericCard extends Component<GenericCardPropsInternal> {
)
columnDisplayName = getColumnDisplayName(columnName)
}
if (columnName === 'externalLink') {
values.push(
howToDownloadSecondaryLabelConfig.isVisible(schema, data) || [],
)
}
const keyValue = [columnDisplayName, value, columnName]
values.push(keyValue)
}
Expand Down

0 comments on commit 1db69f0

Please sign in to comment.