Skip to content

Commit 88dfb40

Browse files
committed
Some further dark-mode fixes, added toggle to homepage
- Homepage toggle especially useful for not-logged-in users since they do not have a dropdown.
1 parent b80b6ed commit 88dfb40

File tree

8 files changed

+31
-17
lines changed

8 files changed

+31
-17
lines changed

resources/sass/_header.scss

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,8 @@ header .search-box {
167167

168168
@include smaller-than($l) {
169169
header .header-links {
170+
@include lightDark(background-color, #fff, #333);
170171
display: none;
171-
background-color: #FFF;
172172
z-index: 10;
173173
right: $-m;
174174
border-radius: 4px;
@@ -180,19 +180,18 @@ header .search-box {
180180
display: block;
181181
}
182182
}
183-
header .links a, header .dropdown-container ul li a {
183+
header .links a, header .dropdown-container ul li a, header .dropdown-container ul li button {
184184
text-align: start;
185185
display: block;
186186
padding: $-s $-m;
187187
color: $text-dark;
188-
fill: $text-dark;
188+
@include lightDark(color, $text-dark, #eee);
189189
svg {
190190
margin-inline-end: $-s;
191191
}
192192
&:hover {
193-
background-color: #EEE;
194-
color: #444;
195-
fill: #444;
193+
@include lightDark(background-color, #eee, #333);
194+
@include lightDark(color, #000, #fff);
196195
text-decoration: none;
197196
}
198197
}

resources/sass/_lists.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -581,6 +581,8 @@ ul.pagination {
581581
@include lightDark(color, #555, #eee);
582582
fill: currentColor;
583583
white-space: nowrap;
584+
line-height: 1.6;
585+
cursor: pointer;
584586
&:hover, &:focus {
585587
text-decoration: none;
586588
background-color: var(--color-primary-light);

resources/views/common/header.blade.php

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,7 @@
7272
</li>
7373
<li><hr></li>
7474
<li>
75-
<form action="{{ url('/settings/users/toggle-dark-mode') }}" method="post">
76-
{{ csrf_field() }}
77-
{{ method_field('patch') }}
78-
@if(setting()->getForCurrentUser('dark-mode-enabled'))
79-
<button>@icon('light-mode'){{ trans('common.light_mode') }}</button>
80-
@else
81-
<button>@icon('dark-mode'){{ trans('common.dark_mode') }}</button>
82-
@endif
83-
</form>
75+
@include('partials.dark-mode-toggle')
8476
</li>
8577
</ul>
8678
</div>

resources/views/common/home-book.blade.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
<div class="icon-list text-primary">
1515
@include('partials.view-toggle', ['view' => $view, 'type' => 'books'])
1616
@include('components.expand-toggle', ['target' => '.entity-list.compact .entity-item-snippet', 'key' => 'home-details'])
17+
@include('partials.dark-mode-toggle', ['classes' => 'text-muted icon-list-item text-primary'])
1718
</div>
1819
</div>
1920
@stop

resources/views/common/home-custom.blade.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
<h5>{{ trans('common.actions') }}</h5>
2020
<div class="icon-list text-primary">
2121
@include('components.expand-toggle', ['target' => '.entity-list.compact .entity-item-snippet', 'key' => 'home-details'])
22+
@include('partials.dark-mode-toggle', ['classes' => 'text-muted icon-list-item text-primary'])
2223
</div>
2324
</div>
2425
@stop

resources/views/common/home-shelves.blade.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
<div class="icon-list text-primary">
1515
@include('partials.view-toggle', ['view' => $view, 'type' => 'shelves'])
1616
@include('components.expand-toggle', ['target' => '.entity-list.compact .entity-item-snippet', 'key' => 'home-details'])
17+
@include('partials.dark-mode-toggle', ['classes' => 'text-muted icon-list-item text-primary'])
1718
</div>
1819
</div>
1920
@stop

resources/views/common/home.blade.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,17 @@
33
@section('body')
44

55
<div class="container px-xl py-s">
6-
<div class="icon-list inline block">
7-
@include('components.expand-toggle', ['target' => '.entity-list.compact .entity-item-snippet', 'key' => 'home-details'])
6+
<div class="grid half">
7+
<div>
8+
<div class="icon-list inline block">
9+
@include('components.expand-toggle', ['target' => '.entity-list.compact .entity-item-snippet', 'key' => 'home-details'])
10+
</div>
11+
</div>
12+
<div class="text-m-right">
13+
<div class="icon-list inline block">
14+
@include('partials.dark-mode-toggle', ['classes' => 'text-muted icon-list-item text-primary'])
15+
</div>
16+
</div>
817
</div>
918
</div>
1019

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<form action="{{ url('/settings/users/toggle-dark-mode') }}" method="post">
2+
{{ csrf_field() }}
3+
{{ method_field('patch') }}
4+
@if(setting()->getForCurrentUser('dark-mode-enabled'))
5+
<button class="{{ $classes ?? '' }}"><span>@icon('light-mode')</span><span>{{ trans('common.light_mode') }}</span></button>
6+
@else
7+
<button class="{{ $classes ?? '' }}"><span>@icon('dark-mode')</span><span>{{ trans('common.dark_mode') }}</span></button>
8+
@endif
9+
</form>

0 commit comments

Comments
 (0)