From 3d49241c5ec81aeb2e042b96d8aaccefeb62f982 Mon Sep 17 00:00:00 2001
From: Philipp Stracker
Date: Tue, 10 Dec 2024 13:58:00 +0100
Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Major=20button-styling=20r?=
=?UTF-8?q?efactoring?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../resources/css/_variables.scss | 17 +++
.../reusable-components/_button.scss | 108 +++++++++++++-----
.../screens/onboarding/_step-welcome.scss | 6 -
.../Components/AdvancedOptionsForm.js | 7 +-
.../Onboarding/Components/ConnectionButton.js | 5 +-
5 files changed, 107 insertions(+), 36 deletions(-)
diff --git a/modules/ppcp-settings/resources/css/_variables.scss b/modules/ppcp-settings/resources/css/_variables.scss
index 73b656f3a..10f427ea9 100644
--- a/modules/ppcp-settings/resources/css/_variables.scss
+++ b/modules/ppcp-settings/resources/css/_variables.scss
@@ -10,6 +10,7 @@ $color-gray-500: #BBBBBB;
$color-gray-400: #CCCCCC;
$color-gray-300: #EBEBEB;
$color-gray-200: #E0E0E0;
+$color-gray-100: #F0F0F0;
$color-gray: #646970;
$color-text-tertiary: #505050;
$color-text-text: #070707;
@@ -27,6 +28,8 @@ $max-width-settings: 938px;
$card-vertical-gap: 48px;
+/* define custom theming options */
+
:root {
--ppcp-color-app-bg: #{$color-white};
}
@@ -37,4 +40,18 @@ $card-vertical-gap: 48px;
--max-width-onboarding-content: #{$max-width-onboarding-content};
--max-container-width: var(--max-width-settings);
+
+ --color-black: #{$color-black};
+ --color-white: #{$color-white};
+ --color-blueberry: #{$color-blueberry};
+ --color-gray-900: #{$color-gray-900};
+ --color-gray-800: #{$color-gray-800};
+ --color-gray-700: #{$color-gray-700};
+ --color-gray-600: #{$color-gray-600};
+ --color-gray-500: #{$color-gray-500};
+ --color-gray-400: #{$color-gray-400};
+ --color-gray-300: #{$color-gray-300};
+ --color-gray-200: #{$color-gray-200};
+ --color-gray-100: #{$color-gray-100};
+ --color-gradient-dark: #{$color-gradient-dark};
}
diff --git a/modules/ppcp-settings/resources/css/components/reusable-components/_button.scss b/modules/ppcp-settings/resources/css/components/reusable-components/_button.scss
index 4174e6a23..558ccaaf2 100644
--- a/modules/ppcp-settings/resources/css/components/reusable-components/_button.scss
+++ b/modules/ppcp-settings/resources/css/components/reusable-components/_button.scss
@@ -1,48 +1,102 @@
+%button-style-default {
+ background-color: var(--button-background);
+ color: var(--button-color);
+ box-shadow: inset 0 0 0 1px var(--button-border-color);
+}
+
+%button-style-hover {
+ background-color: var(--button-hover-background);
+ color: var(--button-hover-color);
+ box-shadow: inset 0 0 0 1px var(--button-hover-border-color);
+}
+
+%button-style-disabled {
+ background-color: var(--button-disabled-background);
+ color: var(--button-disabled-color);
+ box-shadow: inset 0 0 0 1px var(--button-disabled-border-color);
+}
+
+%button-shape-pill {
+ border-radius: 50px;
+ padding: 15px 32px;
+ height: auto;
+}
+
button.components-button, a.components-button {
- &.is-primary, &.is-secondary {
- &:not(:disabled) {
- background-color: $color-black;
- }
+ /* default theme */
+ --button-color: var(--color-gray-900);
+ --button-background: transparent;
+ --button-border-color: transparent;
- &:disabled {
- color: $color-gray-700;
- }
+ --button-hover-color: var(--button-color);
+ --button-hover-background: var(--button-background);
+ --button-hover-border-color: var(--button-border-color);
- border-radius: 50px;
- padding: 15px 32px;
- height: auto;
+ --button-disabled-color: var(--color-gray-500);
+ --button-disabled-background: transparent;
+ --button-disabled-border-color: transparent;
+
+ /* style the button template */
+
+ &:not(:disabled) {
+ @extend %button-style-default;
+ }
+
+ &:hover {
+ @extend %button-style-hover;
+ }
+
+ &:disabled {
+ @extend %button-style-disabled;
+ }
+
+ /*
+ ----------------------------------------------
+ Customize variants using the theming variables
+ */
+
+ &.is-primary,
+ &.is-secondary {
+ @extend %button-shape-pill;
}
&.is-primary {
@include font(14, 18, 900);
- &:not(:disabled) {
- background-color: $color-blueberry;
- color: $color-white;
- }
+ --button-color: #{$color-white};
+ --button-background: #{$color-blueberry};
+
+ --button-disabled-color: #{$color-gray-100};
+ --button-disabled-background: #{$color-gray-500};
}
- &.is-secondary:not(:disabled) {
- border-color: $color-blueberry;
- background-color: $color-white;
- color: $color-blueberry;
+ &.is-secondary {
+ --button-color: #{$color-blueberry};
+ --button-background: #{$color-white};
+ --button-border-color: #{$color-blueberry};
- &:hover {
- background-color: $color-white;
- background: none;
- }
+ --button-disabled-color: #{$color-gray-600};
+ --button-disabled-background: #{$color-gray-100};
+ --button-disabled-border-color: #{$color-gray-400};
}
&.is-tertiary {
- color: $color-blueberry;
-
- &:hover {
- color: $color-gradient-dark;
- }
+ --button-color: #{$color-blueberry};
+ --button-hover-color: #{$color-gradient-dark};
&:focus:not(:disabled) {
border: none;
box-shadow: none;
}
}
+
+ &.small-button {
+ @include small-button;
+ }
+}
+
+.ppcp--is-loading {
+ button.components-button, a.components-button {
+ @extend %button-style-disabled;
+ }
}
diff --git a/modules/ppcp-settings/resources/css/components/screens/onboarding/_step-welcome.scss b/modules/ppcp-settings/resources/css/components/screens/onboarding/_step-welcome.scss
index 47af9c99a..450251b6f 100644
--- a/modules/ppcp-settings/resources/css/components/screens/onboarding/_step-welcome.scss
+++ b/modules/ppcp-settings/resources/css/components/screens/onboarding/_step-welcome.scss
@@ -20,12 +20,6 @@
margin: 0 0 24px 0;
}
- .ppcp-r-toggle-block__toggled-content > button{
- @include small-button;
- color: $color-white;
- border: none;
- }
-
.client-id-error {
color: #cc1818;
margin: -16px 0 24px;
diff --git a/modules/ppcp-settings/resources/js/Components/Screens/Onboarding/Components/AdvancedOptionsForm.js b/modules/ppcp-settings/resources/js/Components/Screens/Onboarding/Components/AdvancedOptionsForm.js
index 9b29815f7..6aabd15fd 100644
--- a/modules/ppcp-settings/resources/js/Components/Screens/Onboarding/Components/AdvancedOptionsForm.js
+++ b/modules/ppcp-settings/resources/js/Components/Screens/Onboarding/Components/AdvancedOptionsForm.js
@@ -145,6 +145,7 @@ const AdvancedOptionsForm = () => {
) }
showIcon={ false }
variant="secondary"
+ className="small-button"
isSandbox={
true /* This button always connects to sandbox */
}
@@ -190,7 +191,11 @@ const AdvancedOptionsForm = () => {
onChange={ setClientSecret }
type="password"
/>
-