Skip to content

Commit

Permalink
fix(shared-types,ui-table): fix color contrast for table sorting icons
Browse files Browse the repository at this point in the history
Closes: INSTUI-4238
  • Loading branch information
HerrTopi committed Oct 3, 2024
1 parent 99f8068 commit b5a60bf
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 6 deletions.
2 changes: 2 additions & 0 deletions packages/shared-types/src/ComponentThemeVariables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1214,6 +1214,8 @@ export type TableColHeaderTheme = {
focusOutlineColor: Colors['contrasts']['blue4570']
focusOutlineWidth: Border['widthMedium']
focusOutlineStyle: Border['style']
unSortedIconColor: Colors['contrasts']['grey4570']
sortedIconColor: Colors['contrasts']['blue4570']
}

export type TableHeadTheme = {
Expand Down
8 changes: 4 additions & 4 deletions packages/ui-table/src/Table/ColHeader/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,16 @@ class ColHeader extends Component<TableColHeaderProps> {
}

renderSortArrow() {
const { sortDirection, onRequestSort } = this.props
const { sortDirection, onRequestSort, styles } = this.props

if (sortDirection === 'ascending') {
return <IconMiniArrowUpLine />
return <IconMiniArrowUpLine css={styles?.sortedIconColor} />
}
if (sortDirection === 'descending') {
return <IconMiniArrowDownLine />
return <IconMiniArrowDownLine css={styles?.sortedIconColor} />
}
if (onRequestSort) {
return <IconMiniArrowDoubleLine css={{ opacity: '30%' }} />
return <IconMiniArrowDoubleLine css={styles?.unSortedIconColor} />
}
return undefined
}
Expand Down
6 changes: 5 additions & 1 deletion packages/ui-table/src/Table/ColHeader/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,11 @@ type TableColHeaderProps = TableColHeaderOwnProps &
>

type TableColHeaderStyle = ComponentStyle<
'colHeader' | 'button' | 'buttonContent'
| 'colHeader'
| 'button'
| 'buttonContent'
| 'unSortedIconColor'
| 'sortedIconColor'
>

const propTypes: PropValidators<PropKeys> = {
Expand Down
8 changes: 8 additions & 0 deletions packages/ui-table/src/Table/ColHeader/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,14 @@ const generateStyle = (
label: 'colHeader__buttonContent',
display: 'flex',
alignItems: 'center'
},
unSortedIconColor: {
label: 'colHeader__unSortedIconColor',
color: componentTheme.unSortedIconColor
},
sortedIconColor: {
label: 'colHeader__sortedIconColor',
color: componentTheme.sortedIconColor
}
}
}
Expand Down
5 changes: 4 additions & 1 deletion packages/ui-table/src/Table/ColHeader/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ const generateComponentTheme = (theme: Theme): TableColHeaderTheme => {

focusOutlineColor: colors?.contrasts?.blue4570,
focusOutlineWidth: borders?.widthMedium,
focusOutlineStyle: borders?.style
focusOutlineStyle: borders?.style,

unSortedIconColor: colors?.contrasts?.grey4570,
sortedIconColor: colors?.contrasts?.blue4570
}

return {
Expand Down

0 comments on commit b5a60bf

Please sign in to comment.