Skip to content

Commit

Permalink
feat(v5): Drop block prop from Button (#5557)
Browse files Browse the repository at this point in the history
  • Loading branch information
kyletsang committed Dec 8, 2020
1 parent da195d3 commit 50781e1
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 16 deletions.
6 changes: 0 additions & 6 deletions src/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ export interface ButtonProps
extends React.HTMLAttributes<HTMLElement>,
BsPrefixPropsWithChildren {
active?: boolean;
block?: boolean;
variant?: ButtonVariant;
size?: 'sm' | 'lg';
type?: ButtonType;
Expand Down Expand Up @@ -54,9 +53,6 @@ const propTypes = {
*/
size: PropTypes.string,

/** Spans the full width of the Button parent */
block: PropTypes.bool,

/** Manually set the visual state of the button to `:active` */
active: PropTypes.bool,

Expand Down Expand Up @@ -93,7 +89,6 @@ const Button: Button = React.forwardRef(
size,
active,
className,
block,
type,
as,
...props
Expand All @@ -107,7 +102,6 @@ const Button: Button = React.forwardRef(
prefix,
active && 'active',
variant && `${prefix}-${variant}`,
block && `${prefix}-block`,
size && `${prefix}-${size}`,
);

Expand Down
4 changes: 0 additions & 4 deletions test/ButtonSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,6 @@ describe('<Button>', () => {
).assertSingle(`a.disabled`);
});

it('Should have block class', () => {
mount(<Button block>Title</Button>).assertSingle(`.btn-block`);
});

it('Should apply variant class', () => {
mount(<Button variant="danger">Title</Button>).assertSingle(`.btn-danger`);
});
Expand Down
8 changes: 4 additions & 4 deletions www/src/examples/Button/Block.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<>
<Button variant="primary" size="lg" block>
<div className="d-grid gap-2">
<Button variant="primary" size="lg">
Block level button
</Button>
<Button variant="secondary" size="lg" block>
<Button variant="secondary" size="lg">
Block level button
</Button>
</>;
</div>;
5 changes: 3 additions & 2 deletions www/src/pages/components/buttons.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,10 @@ Fancy larger or smaller buttons? Add `size="lg"`,

<ReactPlayground codeText={ButtonSizes} />

## Block buttons

Create block level buttons—those that span the full width of a parent—by
adding `block`
Create responsive stacks of full-width, “block buttons” like those in Bootstrap 4
with a mix of our display and gap utilities.

<ReactPlayground codeText={ButtonBlock} />

Expand Down

0 comments on commit 50781e1

Please sign in to comment.