Skip to content

Commit ee4cade

Browse files
committed
style(header): enhance logo and theme switch layout for better alignment
1 parent 9870ab3 commit ee4cade

2 files changed

Lines changed: 41 additions & 35 deletions

File tree

assets/css/common/header.css

Lines changed: 37 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -19,26 +19,27 @@
1919
}
2020

2121
.logo {
22-
flex-wrap: inherit;
22+
align-items: center;
23+
column-gap: 0.55rem;
24+
flex-wrap: wrap;
2325
}
2426

2527
.logo a {
2628
font-size: 24px;
2729
font-weight: 700;
30+
display: flex;
31+
align-items: center;
32+
column-gap: 0.55rem;
2833
}
2934

30-
.logo a img, .logo a svg {
31-
display: inline;
32-
vertical-align: middle;
35+
.logo a img,
36+
.logo a svg {
3337
pointer-events: none;
34-
transform: translate(0, -10%);
3538
border-radius: 6px;
36-
margin-inline-end: 8px;
3739
}
3840

3941
.theme-toggle {
40-
font-size: 26px;
41-
margin: auto 4px;
42+
padding: 0 0.4rem;
4243
}
4344

4445
[data-theme="dark"] .moon {
@@ -49,14 +50,41 @@
4950
display: none;
5051
}
5152

53+
.logo-switches {
54+
display: inline-flex;
55+
gap: 0.4rem;
56+
align-items: inherit;
57+
min-height: stretch;
58+
flex-wrap: inherit;
59+
}
60+
61+
.logo-switches>* {
62+
min-height: inherit;
63+
align-items: center;
64+
display: inline-flex;
65+
}
66+
67+
.lang-menu * {
68+
display: inherit;
69+
min-height: inherit;
70+
align-items: inherit;
71+
}
72+
73+
.lang-menu a {
74+
font-size: 1rem;
75+
font-weight: 500;
76+
padding: 0 0.4rem;
77+
display: inline-flex
78+
}
79+
5280
.menu {
5381
list-style: none;
5482
word-break: keep-all;
5583
overflow-x: auto;
5684
white-space: nowrap;
5785
}
5886

59-
.menu li + li {
87+
.menu li+li {
6088
margin-inline-start: var(--gap);
6189
}
6290

@@ -68,25 +96,3 @@
6896
font-weight: 500;
6997
border-bottom: 2px solid currentColor;
7098
}
71-
72-
.lang-switch li,
73-
.lang-switch ul,
74-
.logo-switches {
75-
display: inline-flex;
76-
margin: auto 4px;
77-
}
78-
79-
.lang-switch {
80-
display: flex;
81-
flex-wrap: inherit;
82-
}
83-
84-
.lang-switch a {
85-
margin: auto 3px;
86-
font-size: 16px;
87-
font-weight: 500;
88-
}
89-
90-
.logo-switches {
91-
flex-wrap: inherit;
92-
}

layouts/partials/header.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@
3737
<div class="logo-switches">
3838
{{- if (not site.Params.disableThemeToggle) }}
3939
<button id="theme-toggle" class="theme-toggle" accesskey="t" title="(Alt + T)" aria-label="Toggle theme">
40-
<svg class="moon" xmlns="http://www.w3.org/2000/svg" width="24" height="18" viewBox="0 0 24 24"
40+
<svg class="moon" xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24"
4141
fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"
4242
stroke-linejoin="round">
4343
<path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"></path>
4444
</svg>
45-
<svg class="sun" xmlns="http://www.w3.org/2000/svg" width="24" height="18" viewBox="0 0 24 24"
45+
<svg class="sun" xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24"
4646
fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"
4747
stroke-linejoin="round">
4848
<circle cx="12" cy="12" r="5"></circle>
@@ -61,9 +61,9 @@
6161
{{- if (not site.Params.disableLangToggle) }}
6262
{{- $lang := .Lang}}
6363
{{- $separator := or $label_text (not site.Params.disableThemeToggle)}}
64+
{{- if $separator }}<span>|</span>{{ end }}
6465
{{- with site.Home.Translations }}
65-
<ul class="lang-switch">
66-
{{- if $separator }}<li>|</li>{{ end }}
66+
<ul class="lang-menu">
6767
{{- range . -}}
6868
{{- if ne $lang .Lang }}
6969
<li>

0 commit comments

Comments
 (0)