diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 56b9e50..047c623 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { ".": "0.15.1" -} \ No newline at end of file +} diff --git a/lib/components/GlobalMenu/AccountMenu.tsx b/lib/components/GlobalMenu/AccountMenu.tsx index f668fb4..26675ee 100644 --- a/lib/components/GlobalMenu/AccountMenu.tsx +++ b/lib/components/GlobalMenu/AccountMenu.tsx @@ -43,6 +43,7 @@ export const AccountMenu = ({ title: account.name, ...(account?.accountNames && { avatarGroup: { + size: 'sm', items: account.accountNames.map((name) => ({ name, type: account.type, @@ -51,6 +52,7 @@ export const AccountMenu = ({ }), ...(!account?.accountNames && { avatar: { + size: 'md', type: account.type, name: account.name, }, diff --git a/lib/components/Icon/IconOrAvatar.tsx b/lib/components/Icon/IconOrAvatar.tsx index adb7742..f865704 100644 --- a/lib/components/Icon/IconOrAvatar.tsx +++ b/lib/components/Icon/IconOrAvatar.tsx @@ -46,10 +46,10 @@ export const IconOrAvatar = ({ size, icon, iconTheme, avatar, avatarGroup }: Ico /** Avatar or AvatarGroup */ if (avatar) { - return ; + return ; } if (avatarGroup) { - return ; + return ; } }; diff --git a/lib/components/List/ListItemIcon.module.css b/lib/components/List/ListItemIcon.module.css index cbe20fe..7639c5f 100644 --- a/lib/components/List/ListItemIcon.module.css +++ b/lib/components/List/ListItemIcon.module.css @@ -1,38 +1,7 @@ -/* media */ - -.media { +.icon { flex-shrink: 0; + position: relative; display: flex; - align-items: center; justify-content: center; - min-width: 1em; - height: 1em; -} - -.media { - font-size: 1.5rem; -} - -.media[data-size="sm"], -.media[data-size="md"] { - min-width: 2.25rem; - height: 2.25rem; -} - -.media[data-size="md"], -.media[data-size="lg"] { - font-size: 1.875rem; -} - -.media[data-size="md"] .icon, -.media[data-size="lg"] .icon { - font-size: 1.75rem; -} - -.media[data-size="xl"] { - font-size: 2.25rem; -} - -.media[data-size="xl"] .icon { - font-size: 2rem; + align-items: center; } diff --git a/lib/components/List/ListItemIcon.tsx b/lib/components/List/ListItemIcon.tsx index 32c7115..5353c03 100644 --- a/lib/components/List/ListItemIcon.tsx +++ b/lib/components/List/ListItemIcon.tsx @@ -1,15 +1,13 @@ -import { type ReactNode, isValidElement } from 'react'; -import { Avatar, AvatarGroup, type AvatarGroupProps, type AvatarProps, type AvatarSize } from '../Avatar'; -import { Icon, type IconName, type IconProps, type IconSize } from '../Icon'; +import type { ReactNode } from 'react'; +import { IconOrAvatar, type IconOrAvatarProps } from '../'; +import styles from './listItemIcon.module.css'; + +import { Icon, type IconSize } from '../Icon'; export type ListItemIconSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl'; -export interface ListItemIconProps { +export interface ListItemIconProps extends IconOrAvatarProps { loading?: boolean; - size?: ListItemIconSize; - icon?: IconProps | IconName | ReactNode; - avatar?: AvatarProps; - avatarGroup?: AvatarGroupProps; children?: ReactNode; } @@ -22,25 +20,9 @@ export const ListItemIcon = ({ loading, size = 'sm', icon, avatar, avatarGroup, return ; } - /** Icon can be custom, a string or an Icon object. */ - - if (icon) { - if (isValidElement(icon)) { - return icon; - } - - const applicableIcon = typeof icon === 'string' ? ({ name: icon } as IconProps) : (icon as IconProps); - - return ; - } - - /** Avatar or AvatarGroup */ - - if (avatar) { - return ; - } - - if (avatarGroup) { - return ; - } + return ( + + {children || } + + ); }; diff --git a/lib/components/Menu/Patterns.stories.ts b/lib/components/Menu/Examples.stories.ts similarity index 98% rename from lib/components/Menu/Patterns.stories.ts rename to lib/components/Menu/Examples.stories.ts index 0d004f0..e82f63c 100644 --- a/lib/components/Menu/Patterns.stories.ts +++ b/lib/components/Menu/Examples.stories.ts @@ -2,7 +2,7 @@ import type { Meta, StoryObj } from '@storybook/react'; import { Menu } from './Menu'; const meta = { - title: 'Menu/Patterns', + title: 'Menu/Examples', component: Menu, // tags: ["autodocs"], parameters: {}, @@ -102,6 +102,7 @@ export const PersonInboxMenu = { export const CompanyMenu: Story = { args: { + theme: 'subtle', color: 'company', defaultIconTheme: 'default', groups: {}, diff --git a/lib/components/Menu/Menu.stories.ts b/lib/components/Menu/Menu.stories.ts index fa55b30..d19969a 100644 --- a/lib/components/Menu/Menu.stories.ts +++ b/lib/components/Menu/Menu.stories.ts @@ -13,6 +13,7 @@ type Story = StoryObj; export const Default: Story = { args: { + theme: 'subtle', items: [ { id: '1', @@ -36,6 +37,7 @@ export const Default: Story = { export const CreatingHiearchy: Story = { args: { + theme: 'subtle', defaultIconTheme: 'default', groups: { shortcuts: { diff --git a/lib/components/Menu/Patterns.mdx b/lib/components/Menu/Patterns.mdx index 0e5978a..7b42f14 100644 --- a/lib/components/Menu/Patterns.mdx +++ b/lib/components/Menu/Patterns.mdx @@ -1,10 +1,10 @@ import { Meta, Controls, Primary, Canvas } from "@storybook/blocks"; -import * as Patterns from "./Patterns.stories"; +import * as Examples from "./Examples.stories"; import * as MenuStories from "./Menu.stories"; import * as GlobalMenuStories from "../GlobalMenu/GlobalMenu.stories"; import * as AccountMenuStories from "../GlobalMenu/AccountMenu.stories"; - + # Menu patterns @@ -32,16 +32,16 @@ Separate by content and avatar. Tie things together with color. ### Personal inbox: - + ### Personal settings: - + ### Company inbox: - + ### Company settings: - + diff --git a/lib/components/Menu/menuItemIcon.module.css b/lib/components/Menu/menuItemIcon.module.css index 74907e7..2fe7d13 100644 --- a/lib/components/Menu/menuItemIcon.module.css +++ b/lib/components/Menu/menuItemIcon.module.css @@ -1,4 +1,5 @@ .icon { + flex-shrink: 0; position: relative; display: flex; justify-content: center; diff --git a/release-please-config.json b/release-please-config.json index 933f2a8..0c61a13 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -32,4 +32,4 @@ } ], "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json" -} \ No newline at end of file +}