Skip to content

Commit

Permalink
fix: positon on mobile
Browse files Browse the repository at this point in the history
  • Loading branch information
Holybasil committed Nov 23, 2023
1 parent aeff86f commit 7accda4
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 5 deletions.
16 changes: 13 additions & 3 deletions src/components/Header/Header.astro
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ const section = frontmatter?.section ?? ""
</div>
)
}
<!-- <ThemeModeToggle client:only="preact" dark={dark} /> -->
<ThemeModeToggle client:only="preact" dark={dark} />
<LanguageSelector class="language-selector" />
<a href="https://github.com/scroll-tech/scroll-documentation" class="github-url" target="_blank" rel="nofollow">
<span
Expand Down Expand Up @@ -176,9 +176,8 @@ const section = frontmatter?.section ?? ""
.tools {
display: flex;
align-items: center;
gap: 8px;
gap: 20px;
width: 100%;
justify-content: space-between;
flex-direction: row-reverse;
}

Expand Down Expand Up @@ -218,9 +217,20 @@ const section = frontmatter?.section ?? ""
font-weight: 600;
@apply border-0 border-solid border-link;
}

.right-box {
gap: 1.5em;
}
.tools {
width: unset;
flex-direction: row;
flex: 1;
gap: 8px;
justify-content: flex-end;
}
.search-item {
flex: 1;
max-width: 346px;
}
.github-url {
width: 35px;
Expand Down
3 changes: 2 additions & 1 deletion src/components/Header/Search/Search.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
outline: 0;
cursor: pointer;
align-items: center;
width: 346px;
width: 100%;
height: 35px;
border-radius: 40px;
font-style: italic;
Expand Down Expand Up @@ -198,6 +198,7 @@

.container {
position: relative;
width: 100%;
}

#searchModal.mini {
Expand Down
6 changes: 6 additions & 0 deletions src/components/Header/Search/Search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,14 @@ export default function Search() {
const body = document.body
if (isOpen) {
body.classList.add("global-search-toggle")
if (window.matchMedia("(max-width: 50em)").matches) {
document.querySelector("#themeModeToggle").style.right = "-43px"
}
} else {
body.classList.remove("global-search-toggle")
if (window.matchMedia("(max-width: 50em)").matches) {
document.querySelector("#themeModeToggle").style.right = 0
}
}
}, [isOpen])

Expand Down
3 changes: 2 additions & 1 deletion src/components/Header/ThemeModeToggle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,9 @@ const ThemeModeToggle = (props) => {

return (
<button
id="themeModeToggle"
className={clsx(
"w-[35px] h-[35px] rounded-[5px] border-solid bg-transparent border border-black dark:border-white text-black dark:text-white",
"relative w-[35px] h-[35px] rounded-[5px] border-solid bg-transparent border border-black dark:border-white text-black dark:text-white",
dark && "border-white text-white"
)}
onClick={handleToggleThemeMode}
Expand Down

0 comments on commit 7accda4

Please sign in to comment.