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

fix(Button): Add bool to propTypes of attached #2105

Merged
merged 3 commits into from
Sep 23, 2017
Merged
Show file tree
Hide file tree
Changes from 2 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
4 changes: 2 additions & 2 deletions src/elements/Button/Button.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ export interface ButtonProps {
/** A button can animate to show hidden content. */
animated?: boolean | 'fade' | 'vertical';

/** A button can be attached to the top or bottom of other content. */
attached?: 'left' | 'right' | 'top' | 'bottom';
/** A button can be attached to other content. */
attached?: boolean | 'left' | 'right' | 'top' | 'bottom';

/** A basic button is less pronounced. */
basic?: boolean;
Expand Down
7 changes: 5 additions & 2 deletions src/elements/Button/Button.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,11 @@ class Button extends Component {
PropTypes.oneOf(['fade', 'vertical']),
]),

/** A button can be attached to the top or bottom of other content. */
attached: PropTypes.oneOf(['left', 'right', 'top', 'bottom']),
/** A button can be attached to other content. */
attached: PropTypes.oneOfType([
PropTypes.bool,
PropTypes.oneOf(['left', 'right', 'top', 'bottom']),
]),

/** A basic button is less pronounced. */
basic: PropTypes.bool,
Expand Down
4 changes: 2 additions & 2 deletions src/elements/Button/ButtonGroup.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ export interface ButtonGroupProps {
/** An element type to render as (string or function). */
as?: any;

/** A button can be attached to the top or bottom of other content. */
attached?: 'left' | 'right' | 'top' | 'bottom';
/** Groups can be attached to other content. */
attached?: boolean | 'left' | 'right' | 'top' | 'bottom';

/** Groups can be less pronounced. */
basic?: boolean;
Expand Down
10 changes: 7 additions & 3 deletions src/elements/Button/ButtonGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
SUI,
useKeyOnly,
useValueAndKey,
useKeyOrValueAndKey,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sort members in alphabetical order, i.e.:

useKeyOnly,
useKeyOrValueAndKey,
useValueAndKey,

useWidthProp,
} from '../../lib'

Expand Down Expand Up @@ -55,8 +56,8 @@ function ButtonGroup(props) {
useKeyOnly(secondary, 'secondary'),
useKeyOnly(toggle, 'toggle'),
useKeyOnly(vertical, 'vertical'),
useValueAndKey(attached, 'attached'),
useValueAndKey(floated, 'floated'),
useKeyOrValueAndKey(attached, 'attached'),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^, same there

useWidthProp(widths),
'buttons',
className,
Expand All @@ -77,8 +78,11 @@ ButtonGroup.propTypes = {
/** An element type to render as (string or function). */
as: customPropTypes.as,

/** A button can be attached to the top or bottom of other content. */
attached: PropTypes.oneOf(['left', 'right', 'top', 'bottom']),
/** Groups can be attached to other content. */
attached: PropTypes.oneOfType([
PropTypes.bool,
PropTypes.oneOf(['left', 'right', 'top', 'bottom']),
]),

/** Groups can be less pronounced. */
basic: PropTypes.bool,
Expand Down
3 changes: 2 additions & 1 deletion test/specs/elements/Button/ButtonGroup-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ describe('ButtonGroup', () => {
widthClass: 'buttons',
})

common.propKeyAndValueToClassName(ButtonGroup, 'attached', ['left', 'right', 'top', 'bottom'])
common.propKeyOrValueAndKeyToClassName(ButtonGroup, 'attached', ['left', 'right', 'top', 'bottom'])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And there 😄


common.propKeyAndValueToClassName(ButtonGroup, 'floated', SUI.FLOATS)

common.propKeyOnlyToClassName(ButtonGroup, 'basic')
Expand Down