add: new list layout design #1

Merged
webfussel merged 1 commit from feature/list-layout into main 2025-05-10 13:35:50 +02:00
7 changed files with 21 additions and 36 deletions

View file

@ -1,8 +1,6 @@
.ButtonGroup { .ButtonGroup {
display: flex; display: flex;
background: var(--color-main); background: var(--color-main);
border-radius: var(--radius-default);
overflow: hidden;
box-shadow: var(--box-shadow-z2); box-shadow: var(--box-shadow-z2);
& button { & button {
@ -24,13 +22,5 @@
--color: var(--color-lightest); --color: var(--color-lightest);
--background: var(--color-main-dark); --background: var(--color-main-dark);
} }
&:first-child {
border-radius: var(--radius-default) 0 0 var(--radius-default);
}
&:last-child {
border-radius: 0 var(--radius-default) var(--radius-default) 0;
}
} }
} }

View file

@ -104,19 +104,9 @@ body {
} }
.content { .content {
padding: 1rem;
min-height: 100dvh; min-height: 100dvh;
} }
.filter-bar {
margin-bottom: 1rem;
}
.pc-wrapper {
gap: 1rem;
margin-bottom: 1rem;
}
.flex-col { .flex-col {
display: flex; display: flex;
flex-direction: column; flex-direction: column;

View file

@ -1,11 +1,8 @@
.PriceCard { .PriceCard {
position: relative; position: relative;
overflow: hidden;
width: 100%; width: 100%;
transition: 150ms;
opacity: 1;
color: var(--color-darkest); color: var(--color-darkest);
background: black; border-bottom: 1px solid var(--color-light);
.bottom { .bottom {
position: absolute; position: absolute;
@ -47,7 +44,6 @@
z-index: 2; z-index: 2;
gap: 1rem; gap: 1rem;
padding: 1rem; padding: 1rem;
border-radius: var(--radius-default);
&.animated { &.animated {
transition: var(--transition-default); transition: var(--transition-default);

View file

@ -1,5 +1,5 @@
<template> <template>
<article class="PriceCard card"> <article class="PriceCard">
<div class="bottom"> <div class="bottom">
<div class="bg-edit"> <div class="bg-edit">
<Icon class="icon" name="uil:pen" mode="svg" /> <Icon class="icon" name="uil:pen" mode="svg" />
@ -75,15 +75,16 @@ const intl = Intl.NumberFormat('de-DE', {
currency: 'EUR', currency: 'EUR',
}) })
const { lengthX, isSwiping } = useSwipe(top, { const { lengthX, direction, isSwiping } = useSwipe(top, {
passive: false, passive: true,
threshold: 30, threshold: 30,
onSwipe() { onSwipe() {
if (lengthX.value > 50 || lengthX.value < -50) { console.log(direction.value)
if (['down', 'up'].includes(direction.value)) return
left.value = `${-clamp(lengthX.value, -100, 100)}px` left.value = `${-clamp(lengthX.value, -100, 100)}px`
}
}, },
onSwipeEnd() { onSwipeEnd() {
if (['down', 'up'].includes(direction.value)) return
if (lengthX.value < -50) update() if (lengthX.value < -50) update()
if (lengthX.value > 50) deleteCard() if (lengthX.value > 50) deleteCard()
left.value = '0' left.value = '0'

View file

@ -17,7 +17,7 @@
@click="sort" @click="sort"
/> />
</aside> </aside>
<div class="pc-wrapper flex-col" role="list"> <div class="flex-col" role="list">
<PpPriceCard <PpPriceCard
v-for="(card, index) in cards" v-for="(card, index) in cards"
:key="card.uuid" :key="card.uuid"
@ -70,7 +70,7 @@ const createCard = (uuid : string) : Card => ({
}) })
const cards = useState<Card[]>('cards', () => [ const cards = useState<Card[]>('cards', () => [
createCard(crypto.randomUUID()), createCard(randomUUID()),
]) ])
const addCard = (card : Card) => { const addCard = (card : Card) => {
@ -102,8 +102,7 @@ const updateCard = () => {
const openModal = (createNew : boolean, index : number) => { const openModal = (createNew : boolean, index : number) => {
if (createNew) { if (createNew) {
currentCardIndex.value = -1 currentCardIndex.value = -1
currentCard.value = createCard(crypto.randomUUID()) currentCard.value = createCard(randomUUID())
modal.value?.$el.showModal() modal.value?.$el.showModal()
return return
} }

View file

@ -1,3 +1,5 @@
export const replaceComma = (value: string | number) => `${value}`.replace(',', '.') export const replaceComma = (value: string | number) => `${value}`.replace(',', '.')
export const clamp = (value: number, min: number, max: number) => Math.min(Math.max(value, min), max) export const clamp = (value: number, min: number, max: number) => Math.min(Math.max(value, min), max)
export const between = (value: number, min: number, max: number) => value >= min && value <= max

7
app/utils/uuid.ts Normal file
View file

@ -0,0 +1,7 @@
export const randomUUID = (): string => {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
const r = Math.random() * 16 | 0;
const v = c === 'x' ? r : (r & 0x3 | 0x8);
return v.toString(16);
})
}