Add destructive variant to <Button>
[MAILPOET-3545]
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -98,6 +98,25 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.mailpoet-button-destructive {
|
||||||
|
background: #fff;
|
||||||
|
border-color: #fff;
|
||||||
|
color: $color-destructive;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background: #fff;
|
||||||
|
border-color: $color-destructive-hover;
|
||||||
|
color: $color-destructive-hover;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:focus {
|
||||||
|
background: #fff;
|
||||||
|
border-color: #fff;
|
||||||
|
box-shadow: 0 0 0 1.5px $color-destructive-hover;
|
||||||
|
color: $color-destructive-hover;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.mailpoet-button-with-spinner {
|
.mailpoet-button-with-spinner {
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
touch-action: none;
|
touch-action: none;
|
||||||
@@ -115,7 +134,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
&.mailpoet-button-secondary:after,
|
&.mailpoet-button-secondary:after,
|
||||||
&.mailpoet-button-tertiary:after {
|
&.mailpoet-button-tertiary:after,
|
||||||
|
&.mailpoet-button-destructive:after {
|
||||||
background-color: rgba(#fff, .8);
|
background-color: rgba(#fff, .8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -131,4 +151,8 @@
|
|||||||
border-color: #eaeaea;
|
border-color: #eaeaea;
|
||||||
color: #828282;
|
color: #828282;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.mailpoet-button-destructive {
|
||||||
|
color: rgba($color-destructive, .4);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -24,6 +24,8 @@ $color-tertiary-hover: darken($color-tertiary, 10%);
|
|||||||
$color-tertiary-light: #e5e9f8;
|
$color-tertiary-light: #e5e9f8;
|
||||||
$color-tertiary-light-hover: darken($color-tertiary-light, 10%);
|
$color-tertiary-light-hover: darken($color-tertiary-light, 10%);
|
||||||
$color-tertiary-light-background: rgba($color-tertiary-light, .3);
|
$color-tertiary-light-background: rgba($color-tertiary-light, .3);
|
||||||
|
$color-destructive: #b52727;
|
||||||
|
$color-destructive-hover: #a02222;
|
||||||
|
|
||||||
// Typography colors
|
// Typography colors
|
||||||
$color-text: $color-tertiary;
|
$color-text: $color-tertiary;
|
||||||
|
@@ -32,6 +32,13 @@ export const WithoutIcons = () => (
|
|||||||
>
|
>
|
||||||
Tertiary button
|
Tertiary button
|
||||||
</Button>
|
</Button>
|
||||||
|
<Button
|
||||||
|
onClick={action('destructive small')}
|
||||||
|
dimension="small"
|
||||||
|
variant="destructive"
|
||||||
|
>
|
||||||
|
Destructive button
|
||||||
|
</Button>
|
||||||
</p>
|
</p>
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
@@ -54,6 +61,12 @@ export const WithoutIcons = () => (
|
|||||||
>
|
>
|
||||||
Tertiary button
|
Tertiary button
|
||||||
</Button>
|
</Button>
|
||||||
|
<Button
|
||||||
|
onClick={action('destructive regular')}
|
||||||
|
variant="destructive"
|
||||||
|
>
|
||||||
|
Destructive button
|
||||||
|
</Button>
|
||||||
</p>
|
</p>
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
@@ -74,6 +87,12 @@ export const WithoutIcons = () => (
|
|||||||
>
|
>
|
||||||
Tertiary button
|
Tertiary button
|
||||||
</Button>
|
</Button>
|
||||||
|
<Button
|
||||||
|
isDisabled
|
||||||
|
variant="destructive"
|
||||||
|
>
|
||||||
|
Destructive button
|
||||||
|
</Button>
|
||||||
</p>
|
</p>
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
@@ -94,6 +113,12 @@ export const WithoutIcons = () => (
|
|||||||
>
|
>
|
||||||
Tertiary button
|
Tertiary button
|
||||||
</Button>
|
</Button>
|
||||||
|
<Button
|
||||||
|
withSpinner
|
||||||
|
variant="destructive"
|
||||||
|
>
|
||||||
|
Destructive button
|
||||||
|
</Button>
|
||||||
</p>
|
</p>
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
@@ -119,6 +144,13 @@ export const WithoutIcons = () => (
|
|||||||
>
|
>
|
||||||
Tertiary button
|
Tertiary button
|
||||||
</Button>
|
</Button>
|
||||||
|
<Button
|
||||||
|
onClick={action('destructive full-width')}
|
||||||
|
isFullWidth
|
||||||
|
variant="destructive"
|
||||||
|
>
|
||||||
|
Destructive button
|
||||||
|
</Button>
|
||||||
</p>
|
</p>
|
||||||
<br />
|
<br />
|
||||||
</>
|
</>
|
||||||
|
@@ -41,6 +41,14 @@ export const WithIcons = () => (
|
|||||||
variant="tertiary"
|
variant="tertiary"
|
||||||
iconStart={icon}
|
iconStart={icon}
|
||||||
/>
|
/>
|
||||||
|
<Button
|
||||||
|
onClick={action('icon end destructive small')}
|
||||||
|
dimension="small"
|
||||||
|
variant="destructive"
|
||||||
|
iconEnd={icon}
|
||||||
|
>
|
||||||
|
Icon end
|
||||||
|
</Button>
|
||||||
</p>
|
</p>
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
@@ -70,6 +78,13 @@ export const WithIcons = () => (
|
|||||||
variant="tertiary"
|
variant="tertiary"
|
||||||
iconStart={icon}
|
iconStart={icon}
|
||||||
/>
|
/>
|
||||||
|
<Button
|
||||||
|
onClick={action('icon end destructive regular')}
|
||||||
|
variant="destructive"
|
||||||
|
iconEnd={icon}
|
||||||
|
>
|
||||||
|
Icon end
|
||||||
|
</Button>
|
||||||
</p>
|
</p>
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
@@ -99,6 +114,13 @@ export const WithIcons = () => (
|
|||||||
variant="tertiary"
|
variant="tertiary"
|
||||||
iconStart={icon}
|
iconStart={icon}
|
||||||
/>
|
/>
|
||||||
|
<Button
|
||||||
|
isDisabled
|
||||||
|
variant="destructive"
|
||||||
|
iconEnd={icon}
|
||||||
|
>
|
||||||
|
Icon end
|
||||||
|
</Button>
|
||||||
</p>
|
</p>
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
@@ -128,6 +150,13 @@ export const WithIcons = () => (
|
|||||||
variant="tertiary"
|
variant="tertiary"
|
||||||
iconStart={icon}
|
iconStart={icon}
|
||||||
/>
|
/>
|
||||||
|
<Button
|
||||||
|
withSpinner
|
||||||
|
variant="destructive"
|
||||||
|
iconEnd={icon}
|
||||||
|
>
|
||||||
|
Icon end
|
||||||
|
</Button>
|
||||||
</p>
|
</p>
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
@@ -161,6 +190,14 @@ export const WithIcons = () => (
|
|||||||
variant="tertiary"
|
variant="tertiary"
|
||||||
iconStart={icon}
|
iconStart={icon}
|
||||||
/>
|
/>
|
||||||
|
<Button
|
||||||
|
onClick={action('icon end destructive full-width')}
|
||||||
|
isFullWidth
|
||||||
|
variant="destructive"
|
||||||
|
iconEnd={icon}
|
||||||
|
>
|
||||||
|
Icon end
|
||||||
|
</Button>
|
||||||
</p>
|
</p>
|
||||||
<br />
|
<br />
|
||||||
</>
|
</>
|
||||||
|
@@ -4,7 +4,7 @@ import classnames from 'classnames';
|
|||||||
interface Props extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
interface Props extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
||||||
children?: React.ReactNode;
|
children?: React.ReactNode;
|
||||||
dimension?: 'small';
|
dimension?: 'small';
|
||||||
variant?: 'secondary' | 'tertiary';
|
variant?: 'secondary' | 'tertiary' | 'destructive';
|
||||||
withSpinner?: boolean; // also disables href and onClick (via pointer-events in CSS)
|
withSpinner?: boolean; // also disables href and onClick (via pointer-events in CSS)
|
||||||
isDisabled?: boolean; // also disables href and onClick (via pointer-events in CSS)
|
isDisabled?: boolean; // also disables href and onClick (via pointer-events in CSS)
|
||||||
isFullWidth?: boolean;
|
isFullWidth?: boolean;
|
||||||
|
Reference in New Issue
Block a user