-
Notifications
You must be signed in to change notification settings - Fork 95
refactor(NcModal): migrate to Typescript and script-setup #7514
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
base: main
Are you sure you want to change the base?
Conversation
a488070 to
09e25d7
Compare
09e25d7 to
8ad5ebb
Compare
- Use Typescript for component - Use vueuse composable instead of custom Timer class Signed-off-by: Ferdinand Thiessen <[email protected]>
Instead of dialog example where we recommend to use NcDialog we should provide an example on how to use the slideshow feature. Signed-off-by: Ferdinand Thiessen <[email protected]>
Signed-off-by: Ferdinand Thiessen <[email protected]>
Signed-off-by: Ferdinand Thiessen <[email protected]>
Signed-off-by: Ferdinand Thiessen <[email protected]>
1. Script 2. Template 3. Styles 4. Docs Signed-off-by: Ferdinand Thiessen <[email protected]>
8ad5ebb to
d4641da
Compare
|
(just a rebase for CI) |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #7514 +/- ##
==========================================
+ Coverage 51.41% 52.20% +0.78%
==========================================
Files 96 95 -1
Lines 3147 3090 -57
Branches 867 863 -4
==========================================
- Hits 1618 1613 -5
+ Misses 1279 1235 -44
+ Partials 250 242 -8 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
I'll check on the morning |
ShGKme
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpicks only.
Thanks for splitting into commits.
| --slideshow-duration: v-bind('cssSlideshowDelay'); | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this variable needed? Cannot we use v-bind('cssSlideshowDelay') directly where the variable is used? Otherwise it looks like creating a CSS variable just to define another CSS variable just to use it in a single place.
| }>() | ||
| const modalId = createElementId() | ||
| const maskElement = useTemplateRef<HTMLDivElement>('mask') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| const maskElement = useTemplateRef<HTMLDivElement>('mask') | |
| const maskElement = useTemplateRef('mask') |
| const modalId = createElementId() | ||
| const maskElement = useTemplateRef<HTMLDivElement>('mask') | ||
| const internalShow = ref(true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems to me we can simplify the component by just using defineModel. Then we don't need the second state, and the rest around the value is simpler. Is there anything blocking it I'm missing?
| useHotKey('Escape', () => { | ||
| const trapStack = getTrapStack() | ||
| // Only close the most recent focus trap modal | ||
| if (trapStack.length === 0 || trapStack[trapStack.length - 1] === focusTrap) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| if (trapStack.length === 0 || trapStack[trapStack.length - 1] === focusTrap) { | |
| if (trapStack.at(-1) === focusTrap) { |
| import { mdiChevronLeft, mdiChevronRight, mdiClose, mdiPause, mdiPlay } from '@mdi/js' | ||
| import { useIntervalFn, useSwipe } from '@vueuse/core' | ||
| import { createFocusTrap } from 'focus-trap' | ||
| import { computed, nextTick, onMounted, onUnmounted, ref, toRef, useTemplateRef, warn as VueWarn, watch, watchEffect } from 'vue' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warn as VueWarn
Seems like we can just use warn now
☑️ Resolves
This consists of multiple refactoring as you can review individually with each commit.
Basically this migrates the component to Typescript and then to script-setup with new consistent tag order.
By doing so also removed the last JS util (Timer) and just uses the
useIntervalFnfrom vueuse.🏁 Checklist
stable8for maintained Vue 2 version or not applicable