-
-
Notifications
You must be signed in to change notification settings - Fork 17
feat: Mobile content-navigation-menu #310
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
96 commits
Select commit
Hold shift + click to select a range
d888ed4
feat: added existing ideas for mobile content navigation menu
therobrob 051b73e
Merge branch 'main' into feat/mobile-content-navigation-menu
therobrob a823843
feat: first draft for mobile content navigation menu
therobrob f258041
Merge branch 'main' into feat/mobile-content-navigation-menu
therobrob 2177f2f
feat: positioning
therobrob a1e9c16
feat: added current value in mobile content navigation menu
therobrob 6b665b5
feat: adjusted rootMargin for mobile
therobrob 143eeb4
feat: add current chapter
therobrob 47e8a40
feat: add current chapter
therobrob 0316c76
Merge branch 'main' into feat/mobile-content-navigation-menu
therobrob aa7aef4
feat: merge highlightHeadline.js
therobrob 825816d
Merge branch 'main' into feat/mobile-content-navigation-menu
therobrob 06bbc29
space for footer
therobrob feec84a
Remove the "current chapter" text
therobrob 3d69b89
Remove the "current chapter" text
therobrob d2355fd
Merge branch 'main' into feat/mobile-content-navigation-menu
therobrob 43e1836
styling
therobrob 64771a7
added country/operator title
therobrob bcf6028
Merge remote-tracking branch 'origin/main' into feat/mobile-content-n…
MoritzWeber0 7bdce38
styling
therobrob 0daa1f3
dragging
therobrob 21b03a0
dragging
therobrob 4ad6a55
dragging
therobrob 92c9835
tidy up
therobrob 1487443
tidy up
therobrob 7185799
tidy up
therobrob 31a7351
tidy up
therobrob 17b56df
Merge branch 'main' into feat/mobile-content-navigation-menu
therobrob 5bbc12e
prettier
therobrob b604437
tidy up
therobrob 7153747
touch-friendly
therobrob 5e4695a
touch-friendly
therobrob ab9adf3
reorganising again
therobrob 21e6c28
prettier
therobrob bc79c78
fix link-click
therobrob 63774d5
fix lockScroll
therobrob 9c6bf6a
tidy up
therobrob 511fd06
tidy up
therobrob 38837e7
tidy up
therobrob 2598a60
renaming
therobrob 76a9b35
renaming
therobrob fb4f252
renaming
therobrob fba3c73
fixing scroll-indicator
therobrob 27958d8
tidy up
therobrob bed3a16
breakpoint-adjustment
therobrob d92291a
Merge branch 'main' into feat/mobile-content-navigation-menu
therobrob fa3f986
remove unused css-properties
therobrob 1ba8b0e
a11y
therobrob 843c33e
a11y
therobrob e3783cd
code-styling-fix
therobrob 39664f4
code-styling-fix
therobrob 404efb5
optimizing lockScroll
therobrob baed251
Merge branch 'main' into feat/mobile-content-navigation-menu
therobrob ba4a8eb
bugfixing review comments
therobrob a2b8520
bugfixing review comments
therobrob c4d5f94
bugfixing review comments
therobrob 7a8a0a7
Merge branch 'main' into feat/mobile-content-navigation-menu
therobrob d6e7798
resolve merge conflict
therobrob bcda49c
removed half-opened-option
therobrob 78b4864
Merge branch 'main' into feat/mobile-content-navigation-menu
therobrob 891d8b8
added border for content element
therobrob 2a1d9c4
renamed bottomSheet to aside
therobrob e3bc496
apply extra-margin only on mobile and when the content-navigation is …
therobrob 250d664
changed border-radius values to css-variable
therobrob 1f97306
prettier
therobrob fcaab9a
Merge branch 'main' into feat/mobile-content-navigation-menu
therobrob 9f02259
fix: Show right-border in mobile navigation by removing width
MoritzWeber0 cde6254
Merge branch 'main' into feat/mobile-content-navigation-menu
therobrob 669f6ac
fix: Provide space for gesture bar on Chrome Android
MoritzWeber0 2cb5546
refactor: Use if/else instead of switch to reduce nesting
MoritzWeber0 7646969
refactor: Use arrow-functions
MoritzWeber0 b45705a
refactor: Reuse showSheet and closeSheet operations
MoritzWeber0 aa71ca4
fixed css-selector
therobrob dda17e1
refactor: Use boolean isClosed instead of string currentState
MoritzWeber0 3e44853
fixed resizeObserver.js
therobrob a0d35de
refactor: Move A11Y settings into openSheet / closeSheet functions
MoritzWeber0 ea849f7
fix: Replace lockScroll with preventDefault()
MoritzWeber0 9af7ebc
fixed css-selector
therobrob 35d8949
refactor: move resize observer into contentNavigation
MoritzWeber0 3d06472
Merge branch 'main' into feat/mobile-content-navigation-menu
MoritzWeber0 576c8e8
fix: Add back overflow: hidden to prevent scrolling
MoritzWeber0 2160afe
refactor: Add event listeners on link element directly
MoritzWeber0 91f5c1a
refactor: Move max-height from JS to CSS
MoritzWeber0 072e90a
fix: Hide content in safe-area-inset-bottom area
MoritzWeber0 57a1433
fix: Preserve background color in safe-area-inset-bottom
MoritzWeber0 839e56c
feat: Add animation for opacity
MoritzWeber0 cefcc7f
Merge branch 'main' into feat/mobile-content-navigation-menu
MoritzWeber0 83e6dc6
feat: Close sheet on overlay click
MoritzWeber0 80a6afa
fix: Support expanding on tap again
MoritzWeber0 cee11a7
fix: Hide border-bottom of header in closed state
MoritzWeber0 3a71cec
fix: Add safe-area-inset-bottom to main margin
MoritzWeber0 702d9b3
some changes
therobrob 60a5e7d
added safe-area-inset-bottom to max-height
therobrob 15bde01
Merge branch 'main' into feat/mobile-content-navigation-menu
therobrob 42aac5e
modified bottom-sheet max-height
therobrob caf0d54
modified bottom-sheet max-height
therobrob File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
MoritzWeber0 marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,121 @@ | ||
| import * as mq from "./mediaqueries"; | ||
|
|
||
| const isMobile = () => { | ||
| return window.matchMedia(mq.maxMD).matches; | ||
| }; | ||
|
|
||
| const initAside = () => { | ||
| const aside = document.querySelector(".o-aside"); | ||
| const asideContent = document.querySelector(".o-aside__content"); | ||
| const handleBtn = document.querySelector(".o-aside__header"); | ||
| const overlay = document.getElementById("overlay"); | ||
|
|
||
| if (!aside || !asideContent || !handleBtn || !overlay) return; | ||
|
|
||
| let isClosed = true; | ||
|
|
||
| const closeSheet = () => { | ||
| isClosed = true; | ||
| aside.classList.remove("o-aside--open"); | ||
| asideContent.removeAttribute("role"); | ||
| asideContent.setAttribute("aria-hidden", "true"); | ||
| handleBtn.setAttribute("aria-expanded", "false"); | ||
| overlay.classList.remove("overlay--show"); | ||
| }; | ||
|
|
||
| const openSheet = () => { | ||
| isClosed = false; | ||
| aside.classList.add("o-aside--open"); | ||
| overlay.classList.add("overlay--show"); | ||
| asideContent.setAttribute("role", "dialog"); | ||
| asideContent.setAttribute("aria-hidden", "false"); | ||
| handleBtn.setAttribute("aria-expanded", "true"); | ||
| }; | ||
|
|
||
| if (isMobile()) { | ||
| closeSheet(); | ||
| } | ||
|
|
||
| const toggleSheet = () => { | ||
| if (isClosed) { | ||
| openSheet(); | ||
| } else { | ||
| closeSheet(); | ||
| } | ||
| }; | ||
|
|
||
| handleBtn.addEventListener("click", toggleSheet); | ||
| overlay.addEventListener("click", closeSheet); | ||
|
|
||
| // Drag support | ||
| let startY = 0; | ||
| let currentY = 0; | ||
| let isDragging = false; | ||
|
|
||
| const dragStart = (e) => { | ||
| startY = e.clientY || e.touches?.[0].clientY; | ||
| isDragging = true; | ||
| }; | ||
|
|
||
| const dragging = (e) => { | ||
| if (!isDragging) return; | ||
| e.preventDefault(); | ||
MoritzWeber0 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| currentY = e.clientY || e.touches?.[0].clientY; | ||
| const deltaY = startY - currentY; | ||
|
|
||
| if (isClosed && deltaY > 50) { | ||
| openSheet(); | ||
| } | ||
|
|
||
| if (!isClosed && deltaY < -50) { | ||
| closeSheet(); | ||
| } | ||
| }; | ||
|
|
||
| const dragEnd = () => { | ||
| if (!isDragging) return; | ||
| isDragging = false; | ||
| }; | ||
|
|
||
| handleBtn.addEventListener("mousedown", dragStart); | ||
| handleBtn.addEventListener("mousemove", dragging); | ||
| handleBtn.addEventListener("mouseup", dragEnd); | ||
|
|
||
| handleBtn.addEventListener("touchstart", dragStart); | ||
| handleBtn.addEventListener("touchmove", dragging); | ||
| handleBtn.addEventListener("touchend", dragEnd); | ||
|
|
||
| // close bottom-sheet if link is clicked | ||
| document.querySelectorAll(".o-aside__toc-link").forEach((link) => { | ||
| link.addEventListener("click", () => { | ||
| if (isMobile()) { | ||
| closeSheet(); | ||
| } | ||
| }); | ||
| }); | ||
|
|
||
| let wasMobile = isMobile(); | ||
|
|
||
| const handleResize = () => { | ||
| if (isMobile() && !wasMobile) { | ||
| wasMobile = true; | ||
| closeSheet(); | ||
| } | ||
| if (!isMobile()) { | ||
| wasMobile = false; | ||
| overlay.classList.remove("overlay--show"); | ||
| aside.classList.remove("o-aside--open"); | ||
| } | ||
| }; | ||
|
|
||
| window.addEventListener("load", handleResize); | ||
| window.addEventListener("resize", handleResize); | ||
| }; | ||
|
|
||
| if (document.readyState === "interactive") { | ||
| initAside(); | ||
| } else { | ||
| window.addEventListener("DOMContentLoaded", () => { | ||
| initAside(); | ||
| }); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
therobrob marked this conversation as resolved.
Show resolved
Hide resolved
MoritzWeber0 marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,194 @@ | ||
| .o-aside { | ||
| margin-bottom: 0; | ||
| position: sticky; | ||
| top: 8rem; | ||
| font-size: 1.4rem; | ||
| line-height: 1.5; | ||
| margin-right: 0; | ||
| z-index: 3; | ||
| display: flex; | ||
| flex-direction: column; | ||
| gap: 1.5rem; | ||
| flex-wrap: wrap; | ||
| height: fit-content; | ||
|
|
||
| ul, | ||
| ol { | ||
| list-style-type: none; | ||
| list-style-position: outside; | ||
| padding-left: 0; | ||
|
|
||
| ul, | ||
| ol { | ||
| margin-bottom: 0; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| .o-aside__header { | ||
| display: none; | ||
| } | ||
|
|
||
| .o-aside a { | ||
| text-decoration-line: none; | ||
| display: flex; | ||
| align-items: flex-start; | ||
| gap: 0.4rem; | ||
| } | ||
|
|
||
| .o-aside__backlink-text { | ||
| display: flex; | ||
| align-items: center; | ||
| gap: 0.4rem; | ||
| } | ||
|
|
||
| .o-aside__toc { | ||
| li { | ||
| list-style-type: none; | ||
| } | ||
|
|
||
| ol { | ||
| padding: 0 0 0 1em; | ||
| } | ||
|
|
||
| > ol { | ||
| padding-left: 0; | ||
| } | ||
| } | ||
|
|
||
| .o-aside__toc-link { | ||
| display: flex; | ||
| } | ||
|
|
||
| .o-aside__toc a[data-current] { | ||
| font-weight: bold; | ||
|
|
||
| &:before { | ||
| content: ""; | ||
| width: 0.4rem; | ||
| height: 2.1rem; | ||
| position: absolute; | ||
| display: flex; | ||
| left: 0; | ||
| background-color: var(--link-default); | ||
| } | ||
| } | ||
|
|
||
| .o-related { | ||
| &__list { | ||
| list-style-type: none; | ||
| list-style-position: outside; | ||
| padding-left: 0; | ||
| } | ||
|
|
||
| &-date { | ||
| padding-left: 2.5rem; | ||
| } | ||
|
|
||
| p { | ||
| margin-bottom: 0; | ||
| } | ||
| } | ||
|
|
||
| .o-related__item img { | ||
| border-radius: var(--border-radius-s); | ||
| } | ||
|
|
||
| @media (max-width: #{$breakpoint-lg}) { | ||
| .o-aside { | ||
| position: fixed; | ||
| top: unset; | ||
| bottom: 0; | ||
| left: 0; | ||
| width: 100%; | ||
| max-height: 100vh; | ||
| gap: 0; | ||
| overflow: hidden; | ||
| flex-flow: column; | ||
| transition: transform 0.5s ease-in-out; | ||
| border-radius: var(--border-radius-m) var(--border-radius-m) 0 0; | ||
| transform: translateY(calc(100% - 6.4rem - env(safe-area-inset-bottom))); | ||
| box-shadow: var(--box-shadow); | ||
| max-height: calc(100vh - 20rem - env(safe-area-inset-bottom)); | ||
|
|
||
| &--open { | ||
| transform: translateY(0); | ||
| } | ||
|
|
||
| &:not(.o-aside--open) { | ||
| > .o-aside__header { | ||
| border-bottom: none; | ||
| } | ||
|
|
||
| > .o-aside__content { | ||
| pointer-events: none; | ||
| user-select: none; | ||
|
|
||
| * { | ||
| opacity: 0; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| &__content { | ||
| background: var(--bg-default); | ||
| overflow-y: scroll; | ||
| overscroll-behavior-y: contain; | ||
| border-left: var(--border); | ||
| border-right: var(--border); | ||
|
|
||
| .o-single__container { | ||
| border: none; | ||
| } | ||
|
|
||
| * { | ||
| transition: opacity 0.3s ease-in-out; | ||
| } | ||
| } | ||
|
|
||
| &__header { | ||
| display: flex; | ||
| align-items: center; | ||
| flex-direction: column; | ||
| gap: 1.5rem; | ||
| width: 100%; | ||
| border: var(--border); | ||
| border-bottom: 1px solid #3d444d; | ||
| padding: 1rem; | ||
| height: 6.4rem; | ||
| border-radius: 1rem 1rem 0 0; | ||
| background: var(--bg-default); | ||
| color: var(--color-body); | ||
| } | ||
|
|
||
| &__drag { | ||
| height: 0.4rem; | ||
| width: 4rem; | ||
| display: block; | ||
| background: var(--color-body); | ||
| border-radius: 2rem; | ||
| } | ||
|
|
||
| &__logo { | ||
| display: flex; | ||
| align-items: center; | ||
| gap: 1.5rem; | ||
| } | ||
| } | ||
|
|
||
| main.o-newspage .o-aside { | ||
| display: none; | ||
| } | ||
| } | ||
|
|
||
| .overlay--show { | ||
| backdrop-filter: blur(4px); | ||
| background-color: rgba(0, 0, 0, 0.6); | ||
| position: fixed; | ||
| inset: 0; | ||
| z-index: 3; | ||
| } | ||
|
|
||
| body:has(.overlay--show) { | ||
| overflow: hidden; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.