Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(OverflowMenu): size prop for v11 #10928

Merged
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2420,7 +2420,7 @@ exports[`DataTable should render 1`] = `
aria-expanded={false}
aria-haspopup={true}
aria-label="Settings"
className="bx--toolbar-action bx--overflow-menu bx--overflow-menu"
className="bx--toolbar-action bx--overflow-menu bx--overflow-menu bx--overflow-menu--md"
onClick={[Function]}
onClose={[Function]}
onKeyDown={[Function]}
Expand Down Expand Up @@ -3408,7 +3408,7 @@ exports[`DataTable sticky header should render 1`] = `
aria-expanded={false}
aria-haspopup={true}
aria-label="Settings"
className="bx--toolbar-action bx--overflow-menu bx--overflow-menu"
className="bx--toolbar-action bx--overflow-menu bx--overflow-menu bx--overflow-menu--md"
onClick={[Function]}
onClose={[Function]}
onKeyDown={[Function]}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ exports[`DataTable.TableToolbarMenu should render 1`] = `
aria-expanded={false}
aria-haspopup={true}
aria-label="Add"
className="custom-class bx--toolbar-action bx--overflow-menu bx--overflow-menu"
className="custom-class bx--toolbar-action bx--overflow-menu bx--overflow-menu bx--overflow-menu--md"
onClick={[Function]}
onClose={[Function]}
onKeyDown={[Function]}
Expand Down
7 changes: 4 additions & 3 deletions packages/react/src/components/OverflowMenu/OverflowMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,10 @@ class OverflowMenu extends Component {

/**
* Specify the size of the OverflowMenu. Currently supports either `sm`, 'md' (default) or 'lg` as an option.
* TODO V11: remove `xl` (replaced with lg)
*/
size: PropTypes.oneOf(['sm', 'md', 'lg', 'xl']),
size: FeatureFlags.enabled('enable-v11-release')
? PropTypes.oneOf(['sm', 'md', 'lg'])
: PropTypes.oneOf(['sm', 'md', 'lg', 'xl']),
};

static contextType = PrefixContext;
Expand Down Expand Up @@ -479,7 +480,7 @@ class OverflowMenu extends Component {
innerRef: ref,
menuOptionsClass,
light,
size,
size = 'md',
...other
} = this.props;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,27 @@ import { Filter16 } from '@carbon/icons-react';
export default {
title: 'Components/OverflowMenu',
component: OverflowMenu,
argTypes: {
size: {
options: ['sm', 'md', 'lg'],
control: { type: 'select' },
},
},
args: {
size: 'md',
},
subcomponents: {
OverflowMenuItem,
},

parameters: {
docs: {
page: mdx,
},
},
};

export const Default = () => (
<OverflowMenu>
export const Default = (args) => (
<OverflowMenu {...args}>
<OverflowMenuItem itemText="Stop app" />
<OverflowMenuItem itemText="Restart app" />
<OverflowMenuItem itemText="Rename app" />
Expand All @@ -39,8 +47,8 @@ Default.story = {
name: 'OverflowMenu',
};

export const RenderCustomIcon = () => (
<OverflowMenu renderIcon={Filter16}>
export const RenderCustomIcon = (args) => (
<OverflowMenu renderIcon={Filter16} {...args}>
<OverflowMenuItem itemText="Filter A" />
<OverflowMenuItem itemText="Filter B" />
</OverflowMenu>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@
height: rem(32px);
}

// TODO V11: Remove xl selector
.#{$prefix}--overflow-menu--xl,
.#{$prefix}--overflow-menu--lg {
width: rem(48px);
height: rem(48px);
Expand Down Expand Up @@ -174,8 +172,6 @@
}
}

// TODO V11: Remove xl selector
.#{$prefix}--overflow-menu-options--xl.#{$prefix}--overflow-menu-options,
.#{$prefix}--overflow-menu-options--lg.#{$prefix}--overflow-menu-options {
&[data-floating-menu-direction='bottom']::after,
&[data-floating-menu-direction='top']::after {
Expand Down Expand Up @@ -225,9 +221,6 @@
height: rem(32px);
}

// TODO V11: Remove xl selector
.#{$prefix}--overflow-menu-options--xl
.#{$prefix}--overflow-menu-options__option,
.#{$prefix}--overflow-menu-options--lg
.#{$prefix}--overflow-menu-options__option {
height: rem(48px);
Expand Down