This commit is contained in:
Arina Yakovenko 2024-07-08 14:10:47 +02:00
parent 2e568395a5
commit 05540db8d3
4 changed files with 34 additions and 54 deletions

13
app.vue
View File

@ -45,7 +45,9 @@
title="Dropdown" title="Dropdown"
:title="''" :title="''"
:pt="{ :pt="{
root: { class: 'w-[100px] h-10 text-left relative' }, root: {
class: 'relative cursor-pointer w-[100px] h-10 text-left relative',
},
dropdown: { dropdown: {
class: 'w-[150px] right-[-50px] absolute mt-4 block', class: 'w-[150px] right-[-50px] absolute mt-4 block',
}, },
@ -78,22 +80,21 @@
:direction="'horizontal'" :direction="'horizontal'"
:pt="{ :pt="{
root: { class: '' }, root: { class: '' },
slider: { class: '' }, slider: { class: 'bg-black text-white' },
counter: { class: '' }, counter: { class: '' },
progress: { class: '' },
}" }"
class="my-[50px] relative z-30" class="my-[50px] relative z-30"
> >
<template #default="{ item }"> <template #default="{ item }">
<div <div
class="bg-white/85 dark:bg-BgDark/85 backdrop-blur-md mx-auto my-4 rounded-3xl w-80 md:w-[800px] shadow-custom-lrb text-black dark:text-white" class="bg-white/85 backdrop-blur-md mx-auto my-4 rounded-3xl w-80 md:w-[800px] shadow-custom-lrb text-black"
> >
<div class="flex justify-between items-center px-8 py-2 border-b-2"> <div class="flex justify-between items-center px-8 py-2 border-b-2">
<p class="font-semibold text-[12px] uppercase tracking-widest"> <p class="font-semibold text-[12px] uppercase tracking-widest">
{{ item.title }} {{ item.title }}
</p> </p>
<div <div class="bg-black rounded-lg w-5 h-0.5 cursor-pointer"></div>
class="bg-BgDark dark:bg-BgLight rounded-lg w-5 h-0.5 cursor-pointer"
></div>
</div> </div>
<div <div
class="flex md:flex-row-reverse flex-col gap-8 py-12 md:py-8 md:w-[800px]" class="flex md:flex-row-reverse flex-col gap-8 py-12 md:py-8 md:w-[800px]"

View File

@ -32,7 +32,7 @@ const props = withDefaults(defineProps<DropDownProps>(), {
const PT = { const PT = {
root: { root: {
class: "relative pointer", class: "",
}, },
dropdown: { dropdown: {
class: class:

View File

@ -27,36 +27,6 @@
<slot :item="item" /> <slot :item="item" />
</swiper-slide> </swiper-slide>
</swiper> </swiper>
<div>
<div :class="counterClasses">
<div
class="bg-BgDark dark:bg-BgLight mt-4 h-1 transition-all duration-500"
:style="`width: ${progerssBar}%`"
></div>
<div class="flex justify-between my-4">
<button
:disabled="isPrevDisabled"
class="px-4 py-2 disabled:text-gray-400 cursor-pointer"
@click="
useRipple($event, true);
goPrev();
"
>
<ArrowLeftIcon class="size-5" />
</button>
<button
:disabled="isNextDisabled"
class="px-4 py-2 disabled:text-gray-400 cursor-pointer"
@click="
useRipple($event, true);
goNext();
"
>
<ArrowRightIcon class="size-5" />
</button>
</div>
</div>
</div>
</div> </div>
</template> </template>
@ -123,7 +93,10 @@ const classes = ref({
counter: { counter: {
class: `max-w-[1200px] mx-auto px-6 container`, class: `max-w-[1200px] mx-auto px-6 container`,
}, },
} as PTAttribs); progress: {
class: "",
},
} as unknown as PTAttribs);
const rootClasses = computed(() => const rootClasses = computed(() =>
twMerge(classes.value.root?.class, props.pt?.root?.class) twMerge(classes.value.root?.class, props.pt?.root?.class)
@ -134,6 +107,9 @@ const sliderClasses = computed(() =>
const counterClasses = computed(() => const counterClasses = computed(() =>
twMerge(classes.value.counter?.class, props.pt?.counter?.class) twMerge(classes.value.counter?.class, props.pt?.counter?.class)
); );
const progressClass = computed(() =>
twMerge(classes.value.progress?.class, props.pt?.progress?.class)
);
const items = props.items; const items = props.items;
</script> </script>

View File

@ -1,22 +1,25 @@
export type SliderProps = { export type SliderProps = {
direction: 'horizontal' | 'vertical'; direction: "horizontal" | "vertical";
pt?: PTAttribs; pt?: PTAttribs;
items: Array<[{ title: string; info: string }]>; items: Array<[{ title: string; info: string }]>;
}; };
export type PTAttribs = { export type PTAttribs = {
root?: { root?: {
class: string; class: string;
}; };
slider?: { slider?: {
class: string; class: string;
}; };
counter?: { counter?: {
class: string; class: string;
}; };
direction?: { direction?: {
direction: string; direction: string;
}; };
progress?: {
direction: string;
};
}; };
export type spinerPlace = 'suffix' | 'prefix'; export type spinerPlace = "suffix" | "prefix";