Skip to content

Commit

Permalink
fix: dialog stories (#81)
Browse files Browse the repository at this point in the history
ingefossland authored Nov 25, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent e1be0de commit 020c141
Showing 11 changed files with 422 additions and 453 deletions.
16 changes: 16 additions & 0 deletions lib/components/Avatar/avatarGroup.module.css
Original file line number Diff line number Diff line change
@@ -17,6 +17,10 @@
width: 32px;
}

.xs[data-count="1"] {
width: 20px;
}

.xs[data-count="2"] * + * {
margin-left: -8px;
}
@@ -33,6 +37,10 @@
width: 42px;
}

.sm[data-count="1"] {
width: 24px;
}

.sm[data-count="2"] * + * {
margin-left: -6px;
}
@@ -49,6 +57,10 @@
width: 54px;
}

.md[data-count="1"] {
width: 30px;
}

.md[data-count="2"] * + * {
margin-left: -6px;
}
@@ -65,6 +77,10 @@
width: 66px;
}

.lg[data-count="1"] {
width: 36px;
}

.lg[data-count="2"] * + * {
margin-left: -6px;
}
1 change: 1 addition & 0 deletions lib/components/Button/buttonBase.module.css
Original file line number Diff line number Diff line change
@@ -7,6 +7,7 @@
overflow: visible;

background: transparent;
text-decoration: none;

/* inherit font & color from ancestor */
color: inherit;
13 changes: 10 additions & 3 deletions lib/components/ContextMenu/ContextMenu.tsx
Original file line number Diff line number Diff line change
@@ -2,19 +2,26 @@
import type { DropdownPlacement, MenuItemProps } from '../';
import { type MenuItemGroups, MenuItems } from '../';
import { useRootContext } from '../RootProvider';
import { ContextMenuBase } from './ContextMenuBase';
import { ContextMenuBase, type ContextMenuSize } from './ContextMenuBase';

export interface ContextMenuProps {
id: string;
items: MenuItemProps[];
placement?: DropdownPlacement;
size?: ContextMenuSize;
groups?: MenuItemGroups;
}

export const ContextMenu = ({ id = 'context-menu', placement = 'right', groups = {}, items }: ContextMenuProps) => {
export const ContextMenu = ({
id = 'context-menu',
placement = 'right',
size,
groups = {},
items,
}: ContextMenuProps) => {
const { currentId, toggleId } = useRootContext();
return (
<ContextMenuBase placement={placement} expanded={currentId === id} onToggle={() => toggleId(id)}>
<ContextMenuBase size={size} placement={placement} expanded={currentId === id} onToggle={() => toggleId(id)}>
<MenuItems groups={groups} items={items} />
</ContextMenuBase>
);
6 changes: 5 additions & 1 deletion lib/components/ContextMenu/ContextMenuBase.tsx
Original file line number Diff line number Diff line change
@@ -3,14 +3,18 @@ import { DropdownBase, IconButton } from '../';
import type { DropdownPlacement } from '../';
import styles from './contextMenuBase.module.css';

export type ContextMenuSize = 'sm' | 'md';

export interface ContextMenuBaseProps {
placement: DropdownPlacement;
expanded: boolean;
size?: ContextMenuSize;
onToggle?: () => void;
children?: ReactNode;
}

export const ContextMenuBase = ({
size = 'sm',
placement = 'right',
expanded = false,
onToggle,
@@ -20,7 +24,7 @@ export const ContextMenuBase = ({
<div className={styles.toggle} data-theme="neutral">
<IconButton
className={styles.button}
size="sm"
size={size}
icon="menu-elipsis-horizontal"
iconSize="md"
variant="text"
Loading

0 comments on commit 020c141

Please sign in to comment.