-
-
Notifications
You must be signed in to change notification settings - Fork 242
fix: settings toggle should use input #1049
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
+235
−91
Merged
Changes from all commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
c498289
fix: settings toggle should use input
abbeyperini 439a09e
fixes: animation, reacty code, and styling
abbeyperini a6a084f
fix: support rtl
abbeyperini 0db4fda
Fix: use theme colors, toggle size
abbeyperini 52963f3
Merge branch 'main' into fix/1028
abbeyperini 19c31f2
fix: unneeded code, tests
abbeyperini 4bcbce9
fix: use useID instead of adding label to "toggle"
abbeyperini 98e4265
Merge branch 'main' into fix/1028
abbeyperini bac8f7b
fix: dot position
abbeyperini 4182e9f
Update app/components/Settings/Toggle.client.vue
abbeyperini 6528caa
Update app/components/Settings/Toggle.client.vue
abbeyperini e82dccd
Update app/components/Settings/Toggle.client.vue
abbeyperini a36bd55
Update app/components/Settings/Toggle.client.vue
abbeyperini ef96b93
Update app/components/Settings/Toggle.client.vue
abbeyperini df6a9d0
Update app/components/Settings/Toggle.client.vue
abbeyperini e1887e2
Update app/components/Settings/Toggle.client.vue
abbeyperini 177d4cc
fix: css instead of js for dir, unneeded code
abbeyperini 9d39717
Update app/components/Settings/Toggle.client.vue
abbeyperini d02f011
Update app/components/Settings/Toggle.client.vue
abbeyperini cfed8ca
chore: clean up slightly
danielroe 96afb3c
chore: move into atomic css, respect `prefers-reduced-motion: reduce`…
danielroe e0836ba
Merge remote-tracking branch 'origin/main' into fix/1028
danielroe 383cfc0
[autofix.ci] apply automated fixes
autofix-ci[bot] ee9b8d5
chore: remove class prop
danielroe ea8723f
chore: update server equivalent following merge
danielroe 4bf2934
refactor: rewrite without extra element
danielroe ab07136
chore: remove cursor-pointer
danielroe 837bc10
fix: forced contrast mode styling, server style tag
abbeyperini 61a0040
fix: forced contrast colors are hard
abbeyperini a5cdb76
fix: force colors are really hard, for real
abbeyperini 8c140aa
fix: animation flash
abbeyperini 219ce0a
Merge branch 'main' into fix/1028
abbeyperini 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
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,18 +1,134 @@ | ||
| <script setup lang="ts"> | ||
| defineProps<{ | ||
| label?: string | ||
| description?: string | ||
| }>() | ||
| const props = withDefaults( | ||
| defineProps<{ | ||
| label: string | ||
| description?: string | ||
| justify?: 'between' | 'start' | ||
| reverseOrder?: boolean | ||
| }>(), | ||
| { | ||
| justify: 'between', | ||
| reverseOrder: false, | ||
| }, | ||
| ) | ||
| </script> | ||
|
|
||
| <template> | ||
| <div class="w-full flex items-center justify-between gap-4 py-1 -my-1"> | ||
| <span v-if="label" class="text-sm text-fg font-medium text-start"> | ||
| {{ label }} | ||
| </span> | ||
| <SkeletonBlock class="h-6 w-11 shrink-0 rounded-full" /> | ||
| <div | ||
| class="grid items-center gap-4 py-1 -my-1 grid-cols-[auto_1fr_auto]" | ||
| :class="[justify === 'start' ? 'justify-start' : '']" | ||
| :style=" | ||
| props.reverseOrder | ||
| ? 'grid-template-areas: \'toggle . label-text\'' | ||
| : 'grid-template-areas: \'label-text . toggle\'' | ||
| " | ||
| > | ||
| <template v-if="props.reverseOrder"> | ||
| <SkeletonBlock class="h-6 w-11 shrink-0 rounded-full" style="grid-area: toggle" /> | ||
| <span | ||
| v-if="label" | ||
| class="text-sm text-fg font-medium text-start" | ||
| style="grid-area: label-text" | ||
| > | ||
| {{ label }} | ||
| </span> | ||
| </template> | ||
| <template v-else> | ||
| <span | ||
| v-if="label" | ||
| class="text-sm text-fg font-medium text-start" | ||
| style="grid-area: label-text" | ||
| > | ||
| {{ label }} | ||
| </span> | ||
| <SkeletonBlock | ||
| class="h-6 w-11 shrink-0 rounded-full" | ||
| style="grid-area: toggle; justify-self: end" | ||
| /> | ||
| </template> | ||
| </div> | ||
| <p v-if="description" class="text-sm text-fg-muted mt-2"> | ||
| {{ description }} | ||
| </p> | ||
| </template> | ||
|
|
||
| <style scoped> | ||
| /* Thumb position: logical property for RTL support */ | ||
| .toggle::before { | ||
| inset-inline-start: 1px; | ||
| } | ||
|
|
||
| /* Track transition */ | ||
| .toggle { | ||
| transition: | ||
| background-color 200ms ease-in-out, | ||
| border-color 100ms ease-in-out; | ||
| } | ||
|
|
||
| .toggle::before { | ||
| transition: | ||
| background-color 200ms ease-in-out, | ||
| translate 200ms ease-in-out; | ||
| } | ||
|
|
||
| /* Hover states */ | ||
| .toggle:hover:not(:checked) { | ||
| background: var(--fg-muted); | ||
| } | ||
|
|
||
| .toggle:checked:hover { | ||
| background: var(--fg-muted); | ||
| border-color: var(--fg-muted); | ||
| } | ||
|
|
||
| /* RTL-aware checked thumb position */ | ||
| :dir(ltr) .toggle:checked::before { | ||
| translate: 20px; | ||
| } | ||
|
|
||
| :dir(rtl) .toggle:checked::before { | ||
| translate: -20px; | ||
| } | ||
|
|
||
| @media (prefers-reduced-motion: reduce) { | ||
| .toggle, | ||
| .toggle::before { | ||
| transition: none; | ||
| } | ||
| } | ||
|
|
||
| /* Support forced colors */ | ||
| @media (forced-colors: active) { | ||
| label > span { | ||
| background: Canvas; | ||
| color: Highlight; | ||
| forced-color-adjust: none; | ||
| } | ||
|
|
||
| label:has(.toggle:checked) > span { | ||
| background: Highlight; | ||
| color: Canvas; | ||
| } | ||
|
|
||
| .toggle::before { | ||
| forced-color-adjust: none; | ||
| background-color: Highlight; | ||
| } | ||
|
|
||
| .toggle, | ||
| .toggle:hover { | ||
| background: Canvas; | ||
| border-color: CanvasText; | ||
| } | ||
|
|
||
| .toggle:checked, | ||
| .toggle:checked:hover { | ||
| background: Highlight; | ||
| border-color: CanvasText; | ||
| } | ||
|
|
||
| .toggle:checked::before { | ||
| background: Canvas; | ||
| } | ||
| } | ||
| </style> |
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.