Skip to content

Commit 4474600

Browse files
committed
fix: positon on mobile
1 parent 6a84859 commit 4474600

File tree

4 files changed

+23
-5
lines changed

4 files changed

+23
-5
lines changed

src/components/Header/Header.astro

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ const section = frontmatter?.section ?? ""
7676
</div>
7777
)
7878
}
79-
<!-- <ThemeModeToggle client:only="preact" dark={dark} /> -->
79+
<ThemeModeToggle client:only="preact" dark={dark} />
8080
<LanguageSelector class="language-selector" />
8181
<a href="https://github.com/scroll-tech/scroll-documentation" class="github-url" target="_blank" rel="nofollow">
8282
<span
@@ -176,9 +176,8 @@ const section = frontmatter?.section ?? ""
176176
.tools {
177177
display: flex;
178178
align-items: center;
179-
gap: 8px;
179+
gap: 20px;
180180
width: 100%;
181-
justify-content: space-between;
182181
flex-direction: row-reverse;
183182
}
184183

@@ -218,9 +217,20 @@ const section = frontmatter?.section ?? ""
218217
font-weight: 600;
219218
@apply border-0 border-solid border-link;
220219
}
220+
221+
.right-box {
222+
gap: 1.5em;
223+
}
221224
.tools {
222225
width: unset;
223226
flex-direction: row;
227+
flex: 1;
228+
gap: 8px;
229+
justify-content: flex-end;
230+
}
231+
.search-item {
232+
flex: 1;
233+
max-width: 346px;
224234
}
225235
.github-url {
226236
width: 35px;

src/components/Header/Search/Search.module.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
outline: 0;
3838
cursor: pointer;
3939
align-items: center;
40-
width: 346px;
40+
width: 100%;
4141
height: 35px;
4242
border-radius: 40px;
4343
font-style: italic;
@@ -195,6 +195,7 @@
195195

196196
.container {
197197
position: relative;
198+
width: 100%;
198199
}
199200

200201
#searchModal.mini {

src/components/Header/Search/Search.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,14 @@ export default function Search() {
1616
const body = document.body
1717
if (isOpen) {
1818
body.classList.add("global-search-toggle")
19+
if (window.matchMedia("(max-width: 50em)").matches) {
20+
document.querySelector("#themeModeToggle").style.right = "-43px"
21+
}
1922
} else {
2023
body.classList.remove("global-search-toggle")
24+
if (window.matchMedia("(max-width: 50em)").matches) {
25+
document.querySelector("#themeModeToggle").style.right = 0
26+
}
2127
}
2228
}, [isOpen])
2329

src/components/Header/ThemeModeToggle.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,9 @@ const ThemeModeToggle = (props) => {
4343

4444
return (
4545
<button
46+
id="themeModeToggle"
4647
className={clsx(
47-
"w-[35px] h-[35px] rounded-[5px] border-solid bg-transparent border border-black dark:border-white text-black dark:text-white",
48+
"relative w-[35px] h-[35px] rounded-[5px] border-solid bg-transparent border border-black dark:border-white text-black dark:text-white",
4849
dark && "border-white text-white"
4950
)}
5051
onClick={handleToggleThemeMode}

0 commit comments

Comments
 (0)