Skip to content

Commit

Permalink
Merge pull request #2728 from daostack/dev
Browse files Browse the repository at this point in the history
Fix toggle tree icons
  • Loading branch information
MeyerPV authored Aug 28, 2024
2 parents 567554a + d70ebb3 commit 3e2ea1f
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

.arrowIconButton {
padding: 0.75rem 1.25rem 0.75rem var(--item-arrow-pl);
width: 2.25rem;
}
.arrowIconButtonHidden {
visibility: hidden;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,56 +14,61 @@ interface TreeItemTriggerContentProps {
isActive: boolean;
isOpen: boolean;
onToggle?: () => void;
handleToggle: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
handleToggle: (
event: React.MouseEvent<HTMLButtonElement, MouseEvent>,
) => void;
}

const TreeItemTriggerContent: FC<TreeItemTriggerContentProps> = (props) => {
const { treeItemTriggerStyles, item, level, isOpen, handleToggle, onToggle } = props;
const { treeItemTriggerStyles, item, level, isOpen, handleToggle, onToggle } =
props;

return (
<>
<ButtonIcon
className={classNames(styles.arrowIconButton, {
[styles.arrowIconButtonHidden]: !onToggle,
})}
onClick={handleToggle}
aria-label={`${isOpen ? "Hide" : "Show"} ${item.name}'s spaces`}
aria-hidden={!onToggle}
>
<SmallArrowIcon
className={classNames(styles.arrowIcon, {
[styles.arrowIconOpen]: isOpen,
<ButtonIcon
className={classNames(styles.arrowIconButton, {
[styles.arrowIconButtonHidden]: !onToggle,
})}
/>
</ButtonIcon>
onClick={handleToggle}
aria-label={`${isOpen ? "Hide" : "Show"} ${item.name}'s spaces`}
aria-hidden={!onToggle}
>
{item.items && item.items?.length > 0 && (
<SmallArrowIcon
className={classNames(styles.arrowIcon, {
[styles.arrowIconOpen]: isOpen,
})}
/>
)}
</ButtonIcon>

<CommonAvatar
name={item.name}
src={item.image}
className={classNames(styles.image, {
[classNames(
styles.imageNonRounded,
treeItemTriggerStyles?.imageNonRounded,
)]: level === 1,
[styles.imageRounded]: level !== 1,
})}
/>
<CommonAvatar
name={item.name}
src={item.image}
className={classNames(styles.image, {
[classNames(
styles.imageNonRounded,
treeItemTriggerStyles?.imageNonRounded,
)]: level === 1,
[styles.imageRounded]: level !== 1,
})}
/>

<span className={classNames(styles.name, treeItemTriggerStyles?.name)}>
{item.name}
</span>
{item.nameRightContent}
{item.rightContent}
{!!item.notificationsAmount && (
<span
className={styles.notificationsAmount}
title={`Notifications amount: ${item.notificationsAmount}`}
aria-label={`Notifications amount: ${item.notificationsAmount}`}
>
{item.notificationsAmount}
<span className={classNames(styles.name, treeItemTriggerStyles?.name)}>
{item.name}
</span>
)}
</>
{item.nameRightContent}
{item.rightContent}
{!!item.notificationsAmount && (
<span
className={styles.notificationsAmount}
title={`Notifications amount: ${item.notificationsAmount}`}
aria-label={`Notifications amount: ${item.notificationsAmount}`}
>
{item.notificationsAmount}
</span>
)}
</>
);
};

Expand Down

0 comments on commit 3e2ea1f

Please sign in to comment.