Skip to content

Commit dac49f9

Browse files
authored
fix: more various dark mode fixes (#5850)
- fixed active nav item colour to be scaled on theme colour when nav is collapsed - fixed internal border colours in node overview card to match other border colours - actually call function to set initial dark mode state instead of passing to state directly - deleted random empty table header in KVM ram resources card - fixed background colour of read-only text inputs (thanks @tobiasdemendonca!) - fixed background colour of boot architectures table in subnet boot arch form - changed secondary row colour to use muted text css variable for better contrast in dark mode - use vanilla variable for link colour for visited links to prevent colour change - modified `u-text--light` to use muted text vanilla colour variable - upgraded maas-react-components to 2.0.2
1 parent 8bf4e8f commit dac49f9

File tree

12 files changed

+62
-69
lines changed

12 files changed

+62
-69
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
"build-storybook": "storybook build"
4747
},
4848
"dependencies": {
49-
"@canonical/maas-react-components": "2.0.1",
49+
"@canonical/maas-react-components": "2.0.2",
5050
"@canonical/macaroon-bakery": "1.3.2",
5151
"@canonical/react-components": "3.6.0",
5252
"@redux-devtools/extension": "3.3.0",

src/app/base/hooks/useDarkMode/useDarkMode.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const getInitialDarkMode = (): boolean => {
1818
};
1919

2020
const useDarkMode = (): [boolean, () => void] => {
21-
const [isDarkMode, setIsDarkMode] = useState<boolean>(getInitialDarkMode);
21+
const [isDarkMode, setIsDarkMode] = useState<boolean>(getInitialDarkMode());
2222

2323
useEffect(() => {
2424
// Apply or remove the dark mode class on the body

src/app/kvm/components/RamResources/RamResources.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ const RamResources = ({
100100
>
101101
<thead>
102102
<tr>
103-
<th></th>
104103
<th className="u-align--right u-text--light u-truncate">
105104
Allocated
106105
<span className="u-nudge-right--small">

src/app/networks/views/Subnets/views/SubnetDetails/components/EditBootArchitectures/BootArchitecturesTable/_index.scss

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,4 @@
2222
width: 20%;
2323
}
2424
}
25-
26-
.boot-architectures-table__row {
27-
background-color: $color-x-light;
28-
29-
&:hover {
30-
background-color: $color-light;
31-
32-
&.is-selected {
33-
background-color: color.scale($color-link, $alpha: -85%);
34-
}
35-
}
36-
}
3725
}

src/scss/_patterns_double-row.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
.p-double-row__secondary-row {
3232
@extend %small-text;
33-
color: $color-mid-dark;
33+
color: var(--vf-color-text-muted);
3434
margin-bottom: 0;
3535
}
3636

src/scss/_patterns_forms.scss

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,9 @@
4646
}
4747
}
4848

49-
// Override Vanilla's default light text for readonly textareas and make text
50-
// small. Used for displaying very long strings, e.g. certificates.
49+
// Make text small for readonly text areas.
50+
// Used for displaying very long strings, e.g. certificates.
5151
.p-textarea--readonly {
52-
color: $color-dark !important;
5352
font-size: #{map.get($font-sizes, small)}rem;
5453
}
5554

src/scss/_patterns_links.scss

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
@mixin maas-links {
22
// Keep normal link colour even when visited
33
a:visited {
4-
color: $color-link;
4+
color: var(--vf-color-link-default);
55

66
// Keep contextual menu link color even when visited
77
&.p-contextual-menu__link {
@@ -15,9 +15,4 @@
1515
background-color: $color-x-light;
1616
padding: $sph--large;
1717
}
18-
19-
// TODO: remove once https://github.com/canonical/vanilla-framework/issues/4368 is released
20-
a.is-on-dark {
21-
color: #3097ff;
22-
}
2318
}

src/scss/_patterns_navigation.scss

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@use "sass:color";
12
//Local overrides to the navigation pattern
23
@mixin maas-navigation {
34
$breakpoint-hardware-menu: 1200px;
@@ -19,4 +20,52 @@
1920
display: none;
2021
}
2122
}
23+
24+
$nav-theme-colors: (
25+
"default": $colors--dark-theme--background-default,
26+
"bark": #585841,
27+
"sage": #4e5f51,
28+
"olive": #3d5f11,
29+
"viridian": #025a3d,
30+
"prussian_green": #225d5c,
31+
"blue": #0060bf,
32+
"purple": #7764d8,
33+
"magenta": #974097,
34+
"red": #a71b33,
35+
);
36+
@each $name, $color in $nav-theme-colors {
37+
.is-maas-#{$name} {
38+
background-color: $color !important;
39+
}
40+
}
41+
42+
@each $name, $color in $nav-theme-colors {
43+
.is-maas-#{$name}--accent {
44+
background-color: color.scale($color, $lightness: 5%) !important;
45+
}
46+
47+
.is-maas-#{$name} {
48+
.p-side-navigation__link:hover, [aria-current=page].p-side-navigation__link, .p-button--base:hover {
49+
background-color: color.scale($color, $lightness: 8%) !important;
50+
}
51+
52+
@media (min-width: $breakpoint-small) {
53+
.p-side-navigation__item.has-active-child {
54+
background-color: color.scale($color, $lightness: 8%);
55+
}
56+
}
57+
58+
@media (min-width: $application-layout--breakpoint-side-nav-expanded) {
59+
.p-side-navigation__item.has-active-child {
60+
background-color: transparent;
61+
}
62+
}
63+
}
64+
65+
.is-maas-#{$name}--accent {
66+
.p-side-navigation__link:hover, [aria-current=page].p-side-navigation__link {
67+
background-color: color.scale($color, $lightness: 12%) !important;
68+
}
69+
}
70+
}
2271
}

src/scss/_pseudo-border.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
&::after,
88
&::before {
9-
background-color: $color-mid-light;
9+
background-color: var(--vf-color-border-default);
1010
content: "";
1111
position: absolute;
1212
}

src/scss/_utilities.scss

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@
235235
}
236236

237237
.u-text--light {
238-
color: $color-mid-dark !important;
238+
color: var(--vf-color-text-muted);
239239
}
240240

241241
.u-upper-case--first:first-letter {
@@ -267,41 +267,4 @@
267267
.u-width--full {
268268
width: 100% !important;
269269
}
270-
271-
$nav-theme-colors: (
272-
"default": $colors--dark-theme--background-default,
273-
"bark": #585841,
274-
"sage": #4e5f51,
275-
"olive": #3d5f11,
276-
"viridian": #025a3d,
277-
"prussian_green": #225d5c,
278-
"blue": #0060bf,
279-
"purple": #7764d8,
280-
"magenta": #974097,
281-
"red": #a71b33,
282-
);
283-
@each $name, $color in $nav-theme-colors {
284-
.is-maas-#{$name} {
285-
background-color: $color !important;
286-
}
287-
}
288-
289-
@each $name, $color in $nav-theme-colors {
290-
.is-maas-#{$name}--accent {
291-
background-color: color.scale($color, $lightness: 5%) !important;
292-
}
293-
294-
.is-maas-#{$name} {
295-
.p-side-navigation__link:hover, [aria-current=page].p-side-navigation__link, .p-button--base:hover {
296-
background-color: color.scale($color, $lightness: 8%) !important;
297-
}
298-
}
299-
300-
.is-maas-#{$name}--accent {
301-
.p-side-navigation__link:hover, [aria-current=page].p-side-navigation__link {
302-
background-color: color.scale($color, $lightness: 12%) !important;
303-
}
304-
}
305-
306-
}
307270
}

0 commit comments

Comments
 (0)