Skip to content

fix(AnalyticalTable): update column header icons to align with latest spec #6598

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,8 @@
display: flex;
justify-content: center;
}

.icon {
height: 0.8rem;
width: 0.8rem;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't this result in subpixels which might cause weird rendering issues?

Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { VirtualItem, Virtualizer } from '@tanstack/react-virtual';
import IconDesign from '@ui5/webcomponents/dist/types/IconDesign.js';
import iconFilter from '@ui5/webcomponents-icons/dist/filter.js';
import iconGroup from '@ui5/webcomponents-icons/dist/group-2.js';
import iconSortAscending from '@ui5/webcomponents-icons/dist/sort-ascending.js';
Expand Down Expand Up @@ -112,15 +113,17 @@ export const ColumnHeader = (props: ColumnHeaderProps) => {
style.textAlign = column.hAlign.toLowerCase() as any;
}

if (column.isSorted) margin++;
if (column.isGrouped) margin++;
if (isFiltered) margin++;
if (column.isSorted) margin += 0.8;
if (column.isGrouped) margin += 0.8;
if (isFiltered) margin += 0.8;

if (margin === 0) {
return style;
}

if (margin > 0) margin += 0.5;
if (margin > 0) {
margin += 0.75;
}

style.marginInlineEnd = `${margin}rem`;

Expand Down Expand Up @@ -218,11 +221,20 @@ export const ColumnHeader = (props: ColumnHeaderProps) => {
className={classNames.iconContainer}
data-component-name={`AnalyticalTableHeaderIconsContainer-${columnId}`}
>
{isFiltered && <Icon name={iconFilter} aria-hidden />}
{isFiltered && (
<Icon design={IconDesign.NonInteractive} name={iconFilter} aria-hidden className={classNames.icon} />
)}
{column.isSorted && (
<Icon name={column.isSortedDesc ? iconSortDescending : iconSortAscending} aria-hidden />
<Icon
design={IconDesign.NonInteractive}
name={column.isSortedDesc ? iconSortDescending : iconSortAscending}
aria-hidden
className={classNames.icon}
/>
)}
{column.isGrouped && (
<Icon design={IconDesign.NonInteractive} name={iconGroup} aria-hidden className={classNames.icon} />
)}
{column.isGrouped && <Icon name={iconGroup} aria-hidden />}
</div>
</div>
{hasPopover && popoverOpen && (
Expand Down
Loading