Skip to content

Commit

Permalink
fix: menu style
Browse files Browse the repository at this point in the history
  • Loading branch information
tsevdos committed Jul 16, 2024
1 parent 5a01d67 commit 034c836
Show file tree
Hide file tree
Showing 12 changed files with 24 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
border-radius: 0.25rem;
width: 100%;
height: auto;
max-height: auto;
overflow: auto;
overflow-x: hidden;
background: #ffffff;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
border-radius: 0.25rem;
width: 100%;
height: auto;
max-height: auto;
overflow: auto;
overflow-x: hidden;
background: #ffffff;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
border-radius: 0.25rem;
width: 100%;
height: 28.125rem;
max-height: auto;
overflow: auto;
overflow-x: hidden;
background: #ffffff;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
border-radius: 0.25rem;
width: 100%;
height: auto;
max-height: auto;
overflow: auto;
overflow-x: hidden;
background: #ffffff;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
border-radius: 0.25rem;
width: 100%;
height: auto;
max-height: auto;
overflow: auto;
overflow-x: hidden;
background: #ffffff;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
border-radius: 0.25rem;
width: 100%;
height: auto;
max-height: auto;
overflow: auto;
overflow-x: hidden;
background: #ffffff;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
border-radius: 0.25rem;
width: 100%;
height: auto;
max-height: auto;
overflow: auto;
overflow-x: hidden;
background: #ffffff;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
border-radius: 0.25rem;
width: 100%;
height: auto;
max-height: auto;
overflow: auto;
overflow-x: hidden;
background: #ffffff;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
border-radius: 0.25rem;
width: 100%;
height: auto;
max-height: auto;
overflow: auto;
overflow-x: hidden;
background: #ffffff;
Expand Down
13 changes: 12 additions & 1 deletion src/components/List/List.style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,17 @@ export const wrapperStyle =
};

export const listStyle =
({ width, height, isSearchable }: { width?: number; height?: number; isSearchable?: boolean }) =>
({
width,
height,
maxHeight,
isSearchable,
}: {
width?: number;
height?: number;
maxHeight?: number;
isSearchable?: boolean;
}) =>
(theme: Theme): SerializedStyles => {
return css`
padding-left: 0;
Expand All @@ -28,6 +38,7 @@ export const listStyle =
border-radius: ${isSearchable ? 'initial' : theme.dimension.borderRadius.get('md')};
width: ${width ? rem(width) : '100%'};
height: ${height ? rem(height) : 'auto'};
max-height: ${maxHeight ? rem(maxHeight) : 'auto'};
overflow: auto;
overflow-x: hidden;
background: ${theme.tokens.colors.get('backgroundColor.default')};
Expand Down
2 changes: 1 addition & 1 deletion src/components/Menu/Menu.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,7 @@ export const MenuWithCustomListWidthAndHeight = {
selectedKeys={btn1.selectedKeys}
rowSize={'compact'}
onSelectionChange={btn1.setSelectedKeys}
sx={{ listProps: { height: 285, width: 190 } }}
sx={{ listProps: { maxHeight: 285, width: 190 } }}
>
{LIST_ITEMS.map((item) => (
<ListItem key={item} textValue={item} parentType={'Menu'}>
Expand Down
4 changes: 2 additions & 2 deletions src/components/Menu/Menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type { TestProps } from 'utils/types';
import { MenuWrapper, MenuItemWrapper, popoverStyle } from './Menu.style';
import MenuItemDivider from './MenuItemDivider';
import { listStyle } from '../List/List.style';
import type { ListProps, ListRowSize } from 'components/List';
import type { ListRowSize } from 'components/List';

export type MenuProps = {
children?: React.ReactElement[] | React.ReactElement;
Expand All @@ -27,7 +27,7 @@ export type MenuProps = {
onAction?: (item: string) => any;
/** The selection mode of the menu */
selectionMode?: 'single' | 'multiple';
sx?: { listProps?: Pick<ListProps, 'height' | 'width'> };
sx?: { listProps?: { maxHeight?: number; width?: number } };
} & TestProps;

const Menu: React.FC<MenuProps> = ({
Expand Down

0 comments on commit 034c836

Please sign in to comment.