add: new design (wip)

New design as WIP, swipe controls
This commit is contained in:
Fiona Lena Urban 2025-05-10 11:13:25 +02:00
parent 7af148058e
commit 3200c29c2f
3 changed files with 9 additions and 12 deletions

View file

@ -8,7 +8,7 @@
color: var(--color-darkest);
position: sticky;
top: 0;
z-index: 1;
z-index: 100;
& strong {
font-size: 2em;

View file

@ -49,6 +49,10 @@
padding: 1rem;
border-radius: var(--radius-default);
&.animated {
transition: var(--transition-default);
}
& > header {
display: flex;
justify-content: space-between;

View file

@ -11,7 +11,8 @@
<div
ref="top"
class="top flex-col"
:style="{ left, transition }"
:class="{ 'animated' : !isSwiping }"
:style="{ left }"
>
<header>
<div class="name-price">
@ -68,14 +69,13 @@ const emit = defineEmits(['remove', 'update'])
const top = useTemplateRef('top')
const left = shallowRef<string>('0')
const transition = shallowRef<string>('none')
const intl = Intl.NumberFormat('de-DE', {
style: 'currency',
currency: 'EUR',
})
const { lengthX } = useSwipe(top, {
const { lengthX, isSwiping } = useSwipe(top, {
passive: false,
threshold: 5,
onSwipe() {
@ -86,14 +86,7 @@ const { lengthX } = useSwipe(top, {
onSwipeEnd() {
if (lengthX.value < -50) update()
if (lengthX.value > 50) deleteCard()
transition.value = '150ms'
setTimeout(() => {
left.value = '0'
setTimeout(() => {
transition.value = 'none'
}, 50)
}, 100)
left.value = '0'
},
})