add: new design (wip)
New design as WIP, swipe controls
This commit is contained in:
parent
7af148058e
commit
3200c29c2f
3 changed files with 9 additions and 12 deletions
|
@ -8,7 +8,7 @@
|
||||||
color: var(--color-darkest);
|
color: var(--color-darkest);
|
||||||
position: sticky;
|
position: sticky;
|
||||||
top: 0;
|
top: 0;
|
||||||
z-index: 1;
|
z-index: 100;
|
||||||
|
|
||||||
& strong {
|
& strong {
|
||||||
font-size: 2em;
|
font-size: 2em;
|
||||||
|
|
|
@ -49,6 +49,10 @@
|
||||||
padding: 1rem;
|
padding: 1rem;
|
||||||
border-radius: var(--radius-default);
|
border-radius: var(--radius-default);
|
||||||
|
|
||||||
|
&.animated {
|
||||||
|
transition: var(--transition-default);
|
||||||
|
}
|
||||||
|
|
||||||
& > header {
|
& > header {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
|
|
@ -11,7 +11,8 @@
|
||||||
<div
|
<div
|
||||||
ref="top"
|
ref="top"
|
||||||
class="top flex-col"
|
class="top flex-col"
|
||||||
:style="{ left, transition }"
|
:class="{ 'animated' : !isSwiping }"
|
||||||
|
:style="{ left }"
|
||||||
>
|
>
|
||||||
<header>
|
<header>
|
||||||
<div class="name-price">
|
<div class="name-price">
|
||||||
|
@ -68,14 +69,13 @@ const emit = defineEmits(['remove', 'update'])
|
||||||
|
|
||||||
const top = useTemplateRef('top')
|
const top = useTemplateRef('top')
|
||||||
const left = shallowRef<string>('0')
|
const left = shallowRef<string>('0')
|
||||||
const transition = shallowRef<string>('none')
|
|
||||||
|
|
||||||
const intl = Intl.NumberFormat('de-DE', {
|
const intl = Intl.NumberFormat('de-DE', {
|
||||||
style: 'currency',
|
style: 'currency',
|
||||||
currency: 'EUR',
|
currency: 'EUR',
|
||||||
})
|
})
|
||||||
|
|
||||||
const { lengthX } = useSwipe(top, {
|
const { lengthX, isSwiping } = useSwipe(top, {
|
||||||
passive: false,
|
passive: false,
|
||||||
threshold: 5,
|
threshold: 5,
|
||||||
onSwipe() {
|
onSwipe() {
|
||||||
|
@ -86,14 +86,7 @@ const { lengthX } = useSwipe(top, {
|
||||||
onSwipeEnd() {
|
onSwipeEnd() {
|
||||||
if (lengthX.value < -50) update()
|
if (lengthX.value < -50) update()
|
||||||
if (lengthX.value > 50) deleteCard()
|
if (lengthX.value > 50) deleteCard()
|
||||||
transition.value = '150ms'
|
|
||||||
|
|
||||||
setTimeout(() => {
|
|
||||||
left.value = '0'
|
left.value = '0'
|
||||||
setTimeout(() => {
|
|
||||||
transition.value = 'none'
|
|
||||||
}, 50)
|
|
||||||
}, 100)
|
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue