Skip to content

Commit

Permalink
chore(OverflowMenu): size prop for v11 (#10928)
Browse files Browse the repository at this point in the history
* chore(OverflowMenu): size prop for v11

* chore(OverflowMenu): updated test

* chore(OverflowMenu): updated test
  • Loading branch information
sstrubberg authored Mar 8, 2022
1 parent 08c5afc commit 9659ff8
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 18 deletions.
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

0 comments on commit 9659ff8

Please sign in to comment.