From 45f702af97334cf0655554a0b0055a5ed41d065b Mon Sep 17 00:00:00 2001 From: Jimmy Domagala-Tang Date: Mon, 17 Apr 2023 09:48:09 -0400 Subject: [PATCH] Merge pull request #12566 from overleaf/jdt-ghost-danger-buttons feat: adding danger ghost buttons GitOrigin-RevId: 2ee6ea1c395ba4a73fbe09b36acde3145c590a6b --- .../components/linking/integration-widget.tsx | 9 +- .../components/linking/sso-widget.tsx | 14 +- .../frontend/stories/style-guide.stories.js | 133 ++++++++++-------- .../stylesheets/components/buttons.less | 11 ++ .../frontend/stylesheets/core/variables.less | 4 + .../frontend/stylesheets/variables/all.less | 4 + 6 files changed, 109 insertions(+), 66 deletions(-) diff --git a/services/web/frontend/js/features/settings/components/linking/integration-widget.tsx b/services/web/frontend/js/features/settings/components/linking/integration-widget.tsx index 987fa8c803..a1120e9612 100644 --- a/services/web/frontend/js/features/settings/components/linking/integration-widget.tsx +++ b/services/web/frontend/js/features/settings/components/linking/integration-widget.tsx @@ -117,7 +117,12 @@ function ActionButton({ ) } else if (linked) { return ( - ) @@ -186,7 +191,7 @@ function UnlinkConfirmationModal({ > {t('cancel')} - diff --git a/services/web/frontend/js/features/settings/components/linking/sso-widget.tsx b/services/web/frontend/js/features/settings/components/linking/sso-widget.tsx index d0c20df4b1..551681de3e 100644 --- a/services/web/frontend/js/features/settings/components/linking/sso-widget.tsx +++ b/services/web/frontend/js/features/settings/components/linking/sso-widget.tsx @@ -112,13 +112,17 @@ function ActionButton({ const { t } = useTranslation() if (unlinkRequestInflight) { return ( - ) } else if (accountIsLinked) { return ( - ) @@ -169,7 +173,11 @@ function UnlinkConfirmModal({ > {t('cancel')} - diff --git a/services/web/frontend/stories/style-guide.stories.js b/services/web/frontend/stories/style-guide.stories.js index 7fb8f68d69..ffac424a98 100644 --- a/services/web/frontend/stories/style-guide.stories.js +++ b/services/web/frontend/stories/style-guide.stories.js @@ -151,81 +151,92 @@ export const Headings = () => { ) } -export const Buttons = (args, { globals: { theme } }) => { +const ButtonsTemplate = (args, { globals: { theme } }) => { return (
- - - -

Buttons

+
+ + + +

Buttons

-

Primary Button

-

- -

+

Primary Button

+

+ +

-

Secondary Button

- {theme.includes('main') ? ( - <> -

- -

-

Deprecated Styles

-

- These are being transitioned to the new secondary style above -

- - ) : ( - '' - )} -

Our secondary button is blue or dark gray:

-
- - -
- -

All button styles

- {theme.includes('main') ? ( -

Includes styles being deprecated

- ) : ( - '' - )} -
- +

Secondary Button

{theme.includes('main') ? ( - + <> +

+ +

+

Deprecated Styles

+

+ These are being transitioned to the new secondary style + above +

+ ) : ( '' )} - - - - - -
+

Our secondary button is blue or dark gray:

+
+ + +
-

Sizes

-
- - - - - -
+

All button styles

+ {theme.includes('main') ? ( +

Includes styles being deprecated

+ ) : ( + '' + )} +
+ + {theme.includes('main') ? ( + + ) : ( + '' + )} + + + + + + +
-

Hyperlinks

-

- Hyperlinks are highlighted as shown. -

- -
-
+

Sizes

+
+ + + + + +
+ +

Hyperlinks

+

+ Hyperlinks are highlighted as shown. +

+ + + +
) } +export const Buttons = ButtonsTemplate.bind({}) +Buttons.args = { + disabled: false, +} + export const Alerts = () => { return (
diff --git a/services/web/frontend/stylesheets/components/buttons.less b/services/web/frontend/stylesheets/components/buttons.less index 1a557a5139..4552708844 100755 --- a/services/web/frontend/stylesheets/components/buttons.less +++ b/services/web/frontend/stylesheets/components/buttons.less @@ -148,6 +148,17 @@ .btn-danger when(@is-new-css = true) { .btn-borderless(@white, @red, @red-60); } +// Danger Ghost and error appear as light red with no border +.btn-danger-ghost when (@is-new-css = false) { + .button-variant(@btn-danger-ghost-color; @btn-danger-ghost-bg; @btn-danger-ghost-border); + // hover for ghost acts different from typical variants, as it's default state has no bg + &:hover { + background-color: @red-10; + } +} +.btn-danger-ghost when (@is-new-css = true) { + .btn-borderless(@red-50, @btn-danger-ghost-bg, @red-10); +} // btn-secondary .btn-secondary when(@is-new-css = false) { &:not(.btn-secondary-info) { diff --git a/services/web/frontend/stylesheets/core/variables.less b/services/web/frontend/stylesheets/core/variables.less index f4ec3e02b6..cc35c3186f 100644 --- a/services/web/frontend/stylesheets/core/variables.less +++ b/services/web/frontend/stylesheets/core/variables.less @@ -234,6 +234,10 @@ @btn-danger-bg: @ol-red; @btn-danger-border: transparent; +@btn-danger-ghost-color: @red-50; +@btn-danger-ghost-bg: transparent; +@btn-danger-ghost-border: transparent; + @btn-link-disabled-color: @gray-light; //== Forms diff --git a/services/web/frontend/stylesheets/variables/all.less b/services/web/frontend/stylesheets/variables/all.less index 3046990c00..c22bdf24f5 100644 --- a/services/web/frontend/stylesheets/variables/all.less +++ b/services/web/frontend/stylesheets/variables/all.less @@ -178,6 +178,10 @@ @btn-danger-bg: @red; @btn-danger-border: transparent; +@btn-danger-ghost-color: @red-50; +@btn-danger-ghost-bg: transparent; +@btn-danger-ghost-border: transparent; + @btn-link-disabled-color: @gray-light; //== Forms