Skip to content

Commit 4fda809

Browse files
committed
frontend: add support for custom icon in actionable-item component
This allows to confugire a custom icon for actionable items with fallback to the carret. Changed that carret icon is only shown in button mode to visually indicate that this element is clickable. The carret is not needed when the element is not clickable.
1 parent 6a1c65a commit 4fda809

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

frontends/web/src/components/actionable-item/actionable-item.tsx

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,36 +22,35 @@ type TProps = {
2222
className?: string;
2323
disabled?: boolean;
2424
children: ReactNode;
25+
icon?: ReactNode;
2526
onClick?: () => void;
2627
}
2728

2829
export const ActionableItem = ({
2930
className = '',
3031
disabled,
3132
children,
33+
icon,
3234
onClick,
3335
}: TProps) => {
3436
const notButton = disabled || onClick === undefined;
3537

36-
const content = (
37-
<div className={styles.content}>
38-
{children}
39-
<ChevronRightDark />
40-
</div>
41-
);
42-
4338
return (
4439
<>
4540
{notButton ? (
4641
<div className={`${styles.container} ${className}`}>
47-
{content}
42+
{children}
43+
{icon && icon}
4844
</div>
4945
) : (
5046
<button
5147
type="button"
5248
className={`${styles.container} ${styles.isButton} ${className}`}
5349
onClick={onClick}>
54-
{content}
50+
{children}
51+
{icon ? icon : (
52+
<ChevronRightDark />
53+
)}
5554
</button>
5655
)}
5756
</>

0 commit comments

Comments
 (0)