added selectable prop

This commit is contained in:
Mamalizz
2025-04-16 22:54:47 +03:30
parent fa89859e42
commit c8de8af5b2
@@ -10,11 +10,14 @@ import { QUERY_KEYS } from "~/constants";
type Props = {
address?: Address;
isSelected?: boolean;
selectable?: boolean;
};
// props
defineProps<Props>();
withDefaults(defineProps<Props>(), {
selectable: true,
});
// emit
@@ -63,7 +66,9 @@ const handleDeleteAddress = (id: number) => {
<template>
<button
@click.prevent="!!address ? emit('select', address) : null"
@click.prevent="
!!address && selectable ? emit('select', address) : null
"
:class="
isSelected
? 'border-transparent ring-2 ring-offset-2 ring-blue-500'
@@ -76,7 +81,7 @@ const handleDeleteAddress = (id: number) => {
</div>
<span class="flex items-center justify-between w-full gap-3">
<div
class="flex items-center gap-3 lg:text-[1.125rem] font-semibold text-slate-900"
class="flex items-center gap-3 max-lg:text-sm font-semibold text-slate-900"
>
{{ !!address ? address.name : "آدرس" }}
<span
@@ -101,7 +106,7 @@ const handleDeleteAddress = (id: number) => {
>
<div class="w-full lg:w-9/12 overflow-hidden">
<div
class="w-full overflow-hidden overflow-ellipsis gap-5 text-start whitespace-pre text-sm text-slate-700"
class="w-full overflow-hidden overflow-ellipsis gap-5 text-start whitespace-pre text-xs lg:text-sm text-slate-700"
>
{{
!!address