Skip to content

Commit

Permalink
fixing more style things
Browse files Browse the repository at this point in the history
  • Loading branch information
Michail Yasonik committed Apr 2, 2020
1 parent 94c78b6 commit 918bebd
Show file tree
Hide file tree
Showing 6 changed files with 128 additions and 139 deletions.
9 changes: 3 additions & 6 deletions src/components/button/__snapshots__/button.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@ exports[`EuiButton props iconSide left is rendered 1`] = `
class="euiButton__content"
>
<div
aria-hidden="true"
class="euiButton__icon"
data-euiicon-type="user"
/>
Expand All @@ -187,7 +186,6 @@ exports[`EuiButton props iconSide right is rendered 1`] = `
class="euiButton__content"
>
<div
aria-hidden="true"
class="euiButton__icon"
data-euiicon-type="user"
/>
Expand All @@ -209,7 +207,6 @@ exports[`EuiButton props iconType is rendered 1`] = `
class="euiButton__content"
>
<div
aria-hidden="true"
class="euiButton__icon"
data-euiicon-type="user"
/>
Expand All @@ -222,7 +219,7 @@ exports[`EuiButton props iconType is rendered 1`] = `

exports[`EuiButton props isDisabled is rendered 1`] = `
<button
class="euiButton euiButton--primary"
class="euiButton euiButton--primary euiButton--disabled"
disabled=""
type="button"
>
Expand All @@ -238,7 +235,7 @@ exports[`EuiButton props isDisabled is rendered 1`] = `

exports[`EuiButton props isDisabled renders a button even when href is defined 1`] = `
<button
class="euiButton euiButton--primary"
class="euiButton euiButton--primary euiButton--disabled"
disabled=""
type="button"
>
Expand All @@ -254,7 +251,7 @@ exports[`EuiButton props isDisabled renders a button even when href is defined 1

exports[`EuiButton props isLoading is rendered 1`] = `
<button
class="euiButton euiButton--primary"
class="euiButton euiButton--primary euiButton--disabled"
disabled=""
type="button"
>
Expand Down
42 changes: 9 additions & 33 deletions src/components/button/_button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -31,28 +31,22 @@
}
}

&:hover,
&:active {
@include euiSlightShadowHover;
}
&:not(.euiButton--disabled) {
&:hover,
&:active {
@include euiSlightShadowHover;
}

&:enabled {
&:hover,
&:focus {
background-color: transparentize($euiColorPrimary, .9);
}
}

&:disabled,
&.euiButton--disabled {
color: $euiButtonColorDisabledText;
border-color: $euiButtonColorDisabled;
pointer-events: none;

.euiButton__content {
pointer-events: auto;
cursor: not-allowed;
}
cursor: not-allowed;

.euiButton__spinner {
border-color: euiLoadingSpinnerBorderColors(currentColor);
Expand All @@ -63,19 +57,6 @@
color: makeHighContrastColor($euiButtonColorDisabled, $euiButtonColorDisabled, 2);
background-color: $euiButtonColorDisabled;
border-color: $euiButtonColorDisabled;

&:hover,
&:focus {
background-color: $euiButtonColorDisabled;
border-color: $euiButtonColorDisabled;
}
}

&:hover,
&:focus {
@include euiSlightShadow;

text-decoration: none;
}
}
}
Expand Down Expand Up @@ -105,7 +86,7 @@

color: $fillTextColor;

&:enabled {
&:not(.euiButton--disabled) {
&:hover,
&:focus {
background-color: darken($color, 5%);
Expand All @@ -114,7 +95,7 @@
}
}

&:enabled {
&:not(.euiButton--disabled) {
$shadowColor: $euiShadowColor;
@if ($name == 'ghost') {
$shadowColor: $euiColorInk;
Expand All @@ -129,18 +110,13 @@
&:focus {
@include euiSlightShadowHover($shadowColor);
background-color: transparentize($color, .9);

@if ($name == 'disabled') {
cursor: not-allowed;
}
}
}
}
}

// Fix ghost/disabled look specifically
.euiButton:disabled.euiButton--ghost,
.euiButton--disabled.euiButton--ghost, {
.euiButton--disabled.euiButton--ghost {
&,
&:hover,
&:focus {
Expand Down
8 changes: 2 additions & 6 deletions src/components/button/button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ export const EuiButton: FunctionComponent<Props> = ({
{
'euiButton--fill': fill,
'euiButton--fullWidth': fullWidth,
'euiButton--disabled': isDisabled,
}
);

Expand All @@ -153,12 +154,7 @@ export const EuiButton: FunctionComponent<Props> = ({
buttonIcon = <EuiLoadingSpinner className="euiButton__spinner" size="m" />;
} else if (iconType) {
buttonIcon = (
<EuiIcon
className="euiButton__icon"
type={iconType}
size="m"
aria-hidden="true"
/>
<EuiIcon className="euiButton__icon" type={iconType} size="m" />
);
}

Expand Down
Loading

0 comments on commit 918bebd

Please sign in to comment.