Skip to content

Commit

Permalink
Added xh-bg-intent-xxx classNames (#3486)
Browse files Browse the repository at this point in the history
  • Loading branch information
jskupsik authored Dec 12, 2023
1 parent 0b1ef6a commit a9502a7
Show file tree
Hide file tree
Showing 13 changed files with 45 additions and 95 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 60.0.0-SNAPSHOT

### ✨ Styles

* Added `xh-bg-intent-xxx` CSS classes, for intent-coloring the `background-color` of elements.

## 59.5.0 - 2023-12-11

### 🎁 New Features
Expand Down
16 changes: 16 additions & 0 deletions admin/tabs/general/alertBanner/AlertBannerPanel.scss
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,20 @@
background-color: var(--xh-bg-alt);
}
}

.xh-button--intent-primary.xh-button--active:not(:hover) {
background-color: var(--xh-intent-primary) !important;
}

.xh-button--intent-success.xh-button--active:not(:hover) {
background-color: var(--xh-intent-success) !important;
}

.xh-button--intent-warning.xh-button--active:not(:hover) {
background-color: var(--xh-intent-warning) !important;
}

.xh-button--intent-danger.xh-button--active:not(:hover) {
background-color: var(--xh-intent-danger) !important;
}
}
16 changes: 0 additions & 16 deletions cmp/badge/Badge.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,4 @@
&--compact {
font-size: 0.5em;
}

&--intent-primary {
background-color: var(--xh-intent-primary);
}

&--intent-success {
background-color: var(--xh-intent-success);
}

&--intent-warning {
background-color: var(--xh-intent-warning);
}

&--intent-danger {
background-color: var(--xh-intent-danger);
}
}
2 changes: 1 addition & 1 deletion cmp/badge/Badge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const [Badge, badge] = hoistCmp.withFactory<BadgeProps>({
splitLayoutProps(props);

if (intent) {
classes.push(`xh-badge--intent-${intent}`);
classes.push(`xh-bg-intent-${intent}`);
}

if (compact) {
Expand Down
22 changes: 1 addition & 21 deletions desktop/appcontainer/Banner.scss
Original file line number Diff line number Diff line change
Expand Up @@ -57,27 +57,7 @@ body.xh-app .xh-banner {
}
}

&.xh-intent-primary {
color: white;
background-color: var(--xh-intent-primary);
}

&.xh-intent-danger {
color: white;
background-color: var(--xh-intent-danger);
}

&.xh-intent-success {
color: white;
background-color: var(--xh-intent-success);
}

&.xh-intent-warning {
color: white;
background-color: var(--xh-intent-warning);
}

&.xh-intent-none {
&.xh-bg-intent-none {
.xh-banner__action-button,
.xh-banner__dismiss-button {
border-color: unset !important;
Expand Down
2 changes: 1 addition & 1 deletion desktop/appcontainer/Banner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const banner = hoistCmp.factory({
className: classNames(
'xh-banner',
className,
intent ? `xh-intent-${intent}` : `xh-intent-none`
intent ? `xh-bg-intent-${intent}` : `xh-bg-intent-none`
),
items: [
hframe({
Expand Down
16 changes: 0 additions & 16 deletions desktop/appcontainer/Toast.scss
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,6 @@
margin: 0 0 0 var(--xh-pad-half-px);
}

&--primary {
background-color: var(--xh-intent-primary);
}

&--warning {
background-color: var(--xh-intent-warning);
}

&--danger {
background-color: var(--xh-intent-danger);
}

&--success {
background-color: var(--xh-intent-success);
}

.bp4-toast-message {
word-break: break-word;
}
Expand Down
2 changes: 1 addition & 1 deletion desktop/appcontainer/ToastSource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class ToastSourceLocalModel extends HoistModel {
let toaster = await this.getToasterAsync(position as ToasterPosition, containerRef);
if (!bpId) {
model['bpId'] = toaster.show({
className: classNames('xh-toast', `xh-toast--${intent}`),
className: classNames('xh-toast', `xh-bg-intent-${intent}`),
icon: div({className: 'xh-toast__icon', item: icon}),
action: actionButtonProps,
onDismiss: () => wait(0).then(() => model.dismiss()),
Expand Down
22 changes: 1 addition & 21 deletions mobile/appcontainer/Banner.scss
Original file line number Diff line number Diff line change
Expand Up @@ -58,27 +58,7 @@ body.xh-app .xh-banner {
color: white !important;
}

&.xh-intent-primary {
color: white;
background-color: var(--xh-intent-primary);
}

&.xh-intent-danger {
color: white;
background-color: var(--xh-intent-danger);
}

&.xh-intent-success {
color: white;
background-color: var(--xh-intent-success);
}

&.xh-intent-warning {
color: white;
background-color: var(--xh-intent-warning);
}

&.xh-intent-none {
&.xh-bg-intent-none {
.xh-banner__action-button,
.xh-banner__dismiss-button {
border-color: unset !important;
Expand Down
2 changes: 1 addition & 1 deletion mobile/appcontainer/Banner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const banner = hoistCmp.factory({
className: classNames(
'xh-banner',
className,
intent ? `xh-intent-${intent}` : `xh-intent-none`
intent ? `xh-bg-intent-${intent}` : `xh-bg-intent-none`
),
items: [
hframe({
Expand Down
16 changes: 0 additions & 16 deletions mobile/appcontainer/Toast.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,6 @@
box-shadow: 0 2px 20px rgba(0, 0, 0, 0.5);
}

&.xh-intent-primary .toast {
background-color: var(--xh-intent-primary);
}

&.xh-intent-danger .toast {
background-color: var(--xh-intent-danger);
}

&.xh-intent-success .toast {
background-color: var(--xh-intent-success);
}

&.xh-intent-warning .toast {
background-color: var(--xh-intent-warning);
}

.toast__message {
margin: 0;
display: flex;
Expand Down
2 changes: 1 addition & 1 deletion mobile/appcontainer/Toast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const toast = hoistCmp.factory({

render({model}) {
const {icon, message, intent, actionButtonProps} = model,
cls = `xh-toast xh-intent-${intent}`;
cls = `xh-toast xh-bg-intent-${intent}`;

return onsenToast({
visible: true,
Expand Down
16 changes: 16 additions & 0 deletions styles/XH.scss
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,22 @@ body.xh-app {
.xh-intent-danger { color: var(--xh-intent-danger); }
.xh-intent-success { color: var(--xh-intent-success); }
.xh-intent-warning { color: var(--xh-intent-warning); }
.xh-bg-intent-primary {
background-color: var(--xh-intent-primary);
color: white;
}
.xh-bg-intent-danger {
background-color: var(--xh-intent-danger);
color: white;
}
.xh-bg-intent-success {
background-color: var(--xh-intent-success);
color: white;
}
.xh-bg-intent-warning {
background-color: var(--xh-intent-warning);
color: white;
}

// Colors - pos/neg (red/green) vals
.xh-pos-val { color: var(--xh-pos-val-color); }
Expand Down

0 comments on commit a9502a7

Please sign in to comment.