Skip to content

Commit

Permalink
fix(AsideHeader): also fix the collapsed items popup
Browse files Browse the repository at this point in the history
  • Loading branch information
kmenshov committed Sep 6, 2024
1 parent 1b38d6b commit d411f9b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 14 deletions.
12 changes: 12 additions & 0 deletions src/components/CompositeBar/Item/Item.scss
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,18 @@ $block: '.#{variables.$ns}composite-bar-item';
height: 100%;
cursor: pointer;

background: none;
color: inherit;
border: none;
font: inherit;
outline: inherit;
text-decoration: inherit;

&:focus-visible {
outline: solid var(--g-color-line-misc);
outline-offset: -2px;
}

&-icon {
color: var(--gn-aside-header-item-icon-color, var(--_--item-icon-color));
margin-right: 10px;
Expand Down
23 changes: 9 additions & 14 deletions src/components/CompositeBar/Item/Item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -300,26 +300,21 @@ function CollapsedPopup({
title: titleEl,
icon: iconEl,
}: MakeItemParams) => {
const res = (
<div
const [Tag, tagProps] = collapseItem.link
? ['a' as const, {href: collapseItem.link}]
: ['button' as const, {}];

return (
<Tag
{...tagProps}
className={b('collapse-item')}
onClick={(
event: React.MouseEvent<HTMLDivElement, MouseEvent>,
) => {
onClick={(event: React.MouseEvent<HTMLElement, MouseEvent>) => {
onItemClick?.(collapseItem, true, event);
}}
>
{iconEl}
{titleEl}
</div>
);

return collapseItem.link ? (
<a href={collapseItem.link} className={b('link')}>
{res}
</a>
) : (
res
</Tag>
);
};

Expand Down

0 comments on commit d411f9b

Please sign in to comment.