Skip to content

Commit e0261ae

Browse files
chore: theme toggle icon tiny improvements
1 parent 131af41 commit e0261ae

File tree

5 files changed

+41
-20
lines changed

5 files changed

+41
-20
lines changed

src/app/common/social-wrapper/social-wrapper.component.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,4 @@
2727
rel="nofollow">
2828
<i class="fa-brands fa-discord"></i>
2929
</a>
30-
<app-theme-mode-toggle></app-theme-mode-toggle>
3130
</div>

src/app/common/social-wrapper/social-wrapper.component.scss

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
.social-wrapper {
1313
@extend .center-top;
1414
float: right;
15-
padding-right: 40px;
1615
position: relative;
1716
display: flex;
1817

@@ -41,18 +40,16 @@
4140
color: var(--primary);
4241
}
4342
}
44-
@include media(medium) {
45-
padding-right: 20px;
46-
}
43+
4744
@include media(small) {
4845
top: 0;
4946
transform: none;
50-
padding-right: 0;
5147

5248
a {
5349
display: none;
5450
}
5551
}
52+
5653
@media print {
5754
display: none;
5855
}

src/app/homepage/header/header.component.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
</div>
4444
</button>
4545
<ng-content></ng-content>
46+
<app-theme-mode-toggle></app-theme-mode-toggle>
4647
<app-social-wrapper></app-social-wrapper>
4748
<div class="menu-wrapper">
4849
<div class="search-wrapper" id="search">

src/app/shared/components/theme-mode-toggle/theme-mode-toggle.component.scss

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,23 @@
1-
@import '../../../../scss//utils.scss';
1+
@use '../../../../scss/utils';
22

33
:host {
4-
display: block;
5-
display: flex;
4+
@extend .center-top;
5+
position: relative;
6+
display: inline-flex;
67
align-items: center;
78
justify-content: center;
9+
float: right;
10+
padding-right: 40px;
11+
12+
@include utils.media(medium) {
13+
padding-right: 20px;
14+
}
15+
16+
@include utils.media(small) {
17+
position: absolute;
18+
right: 20px;
19+
padding-right: 0;
20+
}
821
}
922

1023
.theme-mode-toggle {
@@ -29,31 +42,40 @@
2942
padding-left: 15px;
3043
position: relative;
3144

32-
@include media(small) {
45+
@include utils.media(small) {
3346
padding: 0;
3447
margin: 0;
3548
}
3649

3750
.material-icons {
3851
font-size: 20px;
3952
cursor: pointer;
53+
@include utils.text-gradient();
54+
55+
@include utils.media(small) {
56+
background: #fff;
57+
}
4058

4159
&::before {
4260
content: '';
4361
position: absolute;
4462
background: #fff;
4563
opacity: 0.2;
46-
left: 2px;
47-
top: 0;
64+
left: 0px;
65+
top: 2px;
4866
bottom: 2px;
4967
width: 2px;
5068
}
5169

5270
&:hover {
53-
color: var(--primary);
71+
background: #fff;
72+
73+
@include utils.media(small) {
74+
@include utils.text-gradient();
75+
}
5476
}
5577

56-
@include media(small) {
78+
@include utils.media(small) {
5779
font-size: 24px;
5880

5981
&::before {

src/app/shared/components/theme-mode-toggle/theme-mode-toggle.component.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,14 @@ export class ThemeModeToggleComponent implements OnInit {
1919
) {}
2020

2121
ngOnInit() {
22-
const userPrefersTheme =
23-
this.mediaMatcher.matchMedia &&
24-
this.mediaMatcher.matchMedia('(prefers-color-scheme: light)').matches;
25-
// In case the user has used the toggle button, we prioritize it over the
26-
// system settings
27-
this.setThemeMode(this.getUserSettingsIsDarkMode() || userPrefersTheme);
22+
// This is commented out because by default the theme mode is set to light (at least for now)
23+
// const userPrefersTheme =
24+
// this.mediaMatcher.matchMedia &&
25+
// this.mediaMatcher.matchMedia('(prefers-color-scheme: light)').matches;
26+
// this.setThemeMode(this.getUserSettingsIsDarkMode() || userPrefersTheme);
27+
28+
const isDarkMode = this.getUserSettingsIsDarkMode();
29+
this.setThemeMode(isDarkMode);
2830
}
2931

3032
toggleThemeMode() {

0 commit comments

Comments
 (0)