diff --git a/src/components/ui/alert/Alert.vue b/src/components/ui/alert/Alert.vue new file mode 100644 index 0000000..7c74e2a --- /dev/null +++ b/src/components/ui/alert/Alert.vue @@ -0,0 +1,16 @@ + + + diff --git a/src/components/ui/alert/AlertDescription.vue b/src/components/ui/alert/AlertDescription.vue new file mode 100644 index 0000000..40e116d --- /dev/null +++ b/src/components/ui/alert/AlertDescription.vue @@ -0,0 +1,12 @@ + + + diff --git a/src/components/ui/alert/AlertTitle.vue b/src/components/ui/alert/AlertTitle.vue new file mode 100644 index 0000000..7f2fd79 --- /dev/null +++ b/src/components/ui/alert/AlertTitle.vue @@ -0,0 +1,12 @@ + + + diff --git a/src/components/ui/alert/index.ts b/src/components/ui/alert/index.ts new file mode 100644 index 0000000..08590d7 --- /dev/null +++ b/src/components/ui/alert/index.ts @@ -0,0 +1,23 @@ +import { cva, type VariantProps } from 'class-variance-authority' + +export { default as Alert } from './Alert.vue' +export { default as AlertTitle } from './AlertTitle.vue' +export { default as AlertDescription } from './AlertDescription.vue' + +export const alertVariants = cva( + 'relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground', + { + variants: { + variant: { + default: 'bg-background text-foreground', + destructive: + 'border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive', + }, + }, + defaultVariants: { + variant: 'default', + }, + }, +) + +export type AlertVariants = VariantProps diff --git a/src/deck/Deck.vue b/src/deck/Deck.vue index 2ed6237..c21be4e 100644 --- a/src/deck/Deck.vue +++ b/src/deck/Deck.vue @@ -49,6 +49,22 @@ const slides = [ const { index, direction, goto, next, prev, isFirst, isLast } = useDeck(slides.length) const current = computed(() => slides[index.value]) const transitionName = computed(() => (direction.value === 1 ? 'slide-next' : 'slide-prev')) + +// swipe navigation (touch) โ€” horizontal only, so vertical scrolling still works +let touchX = 0 +let touchY = 0 +function onTouchStart(e: TouchEvent) { + touchX = e.changedTouches[0].clientX + touchY = e.changedTouches[0].clientY +} +function onTouchEnd(e: TouchEvent) { + const dx = e.changedTouches[0].clientX - touchX + const dy = e.changedTouches[0].clientY - touchY + if (Math.abs(dx) > 60 && Math.abs(dx) > Math.abs(dy) * 1.5) { + if (dx < 0) next() + else prev() + } +}