Skip to content

Commit

Permalink
Make "m" the default size of EuiButton (#1742)
Browse files Browse the repository at this point in the history
* Change prop type docs for EuiButtonGroup

* Update Typescript definition

* Revert "Update Typescript definition"

This reverts commit 5c40b88.

* Revert "Change prop type docs for EuiButtonGroup"

This reverts commit 8d94a34.

* Don't apply a class

* Update Jest snapshots

* Update CHANGELOG

* Clean up entry

* Update Typescript definition for Button
  • Loading branch information
Kerry350 authored Mar 20, 2019
1 parent bff0469 commit bc991d4
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## [`master`](https://github.com/elastic/eui/tree/master)

No public interface changes since `9.4.2`.
- Changed `EuiButton` to use "m" as it's default `size` prop ([#1742](https://github.com/elastic/eui/pull/1742))

## [`9.4.2`](https://github.com/elastic/eui/tree/v9.4.2)

Expand Down
15 changes: 15 additions & 0 deletions src/components/button/__snapshots__/button.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,21 @@ exports[`EuiButton props size l is rendered 1`] = `
</button>
`;

exports[`EuiButton props size m is rendered 1`] = `
<button
class="euiButton euiButton--primary"
type="button"
>
<span
class="euiButton__content"
>
<span
class="euiButton__text"
/>
</span>
</button>
`;

exports[`EuiButton props size s is rendered 1`] = `
<button
class="euiButton euiButton--primary euiButton--small"
Expand Down
2 changes: 2 additions & 0 deletions src/components/button/button.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export const COLORS = Object.keys(colorToClassNameMap);

const sizeToClassNameMap = {
s: 'euiButton--small',
m: null,
l: 'euiButton--large',
};

Expand Down Expand Up @@ -198,6 +199,7 @@ EuiButton.propTypes = {
};

EuiButton.defaultProps = {
size: 'm',
type: 'button',
iconSide: 'left',
color: 'primary',
Expand Down
2 changes: 1 addition & 1 deletion src/components/button/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ declare module '@elastic/eui' {
| 'warning'
| 'danger'
| 'ghost';
export type ButtonSize = 's' | 'l';
export type ButtonSize = 's' | 'm' | 'l';

export interface EuiButtonProps {
iconType?: IconType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ exports[`EuiSuperUpdateButton is rendered 1`] = `
isDisabled={false}
isLoading={false}
onClick={[Function]}
size="m"
textProps={
Object {
"className": "euiSuperUpdateButton__text",
Expand Down Expand Up @@ -41,6 +42,7 @@ exports[`EuiSuperUpdateButton isDisabled 1`] = `
isDisabled={true}
isLoading={false}
onClick={[Function]}
size="m"
textProps={
Object {
"className": "euiSuperUpdateButton__text",
Expand All @@ -67,6 +69,7 @@ exports[`EuiSuperUpdateButton isLoading 1`] = `
isDisabled={false}
isLoading={true}
onClick={[Function]}
size="m"
textProps={
Object {
"className": "euiSuperUpdateButton__text",
Expand Down Expand Up @@ -94,6 +97,7 @@ exports[`EuiSuperUpdateButton needsUpdate 1`] = `
isDisabled={false}
isLoading={false}
onClick={[Function]}
size="m"
textProps={
Object {
"className": "euiSuperUpdateButton__text",
Expand Down

0 comments on commit bc991d4

Please sign in to comment.