schon/storefront/components/ui/checkbox.vue
Alexandr SaVBaD Waltz 761fecf67f Features: 1) Add useWishlistOverwrite composable for wishlist mutations, including adding, removing, and bulk actions; 2) Introduce new localized UI texts for cart and wishlist operations; 3) Enhance filtering logic with parseAttributesString and route query synchronization;
Fixes: 1) Replace `ElNotification` calls with `useNotification` utility across all authentication and user-related composables; 2) Add missing semicolons in multiple index exports and styled components; 3) Resolve issues with reactivity in `useStore` composable by renaming and restructuring product variables;

Extra: 1) Refactor localized strings and translations for better readability and maintenance; 2) Tweak styles including scoped styles, z-index adjustments, and SCSS mixins; 3) Remove unused components and imports to streamline storefront layout.
2025-07-06 19:49:26 +03:00

92 lines
No EOL
1.7 KiB
Vue

<template>
<label class="checkbox" :class="{ isAccent }">
<input
:id="id"
class="checkbox__input"
type="checkbox"
:checked="modelValue"
@change="onChange"
/>
<span class="checkbox__block"></span>
<span class="checkbox__label">
<slot/>
</span>
</label>
</template>
<script setup lang="ts">
const props = defineProps<{
id?: string,
modelValue: boolean,
isAccent?: boolean
}>();
const emit = defineEmits<{
(e: 'update:modelValue', v: boolean): void
}>();
function onChange(e: Event) {
const checked = (e.target as HTMLInputElement).checked;
emit('update:modelValue', checked);
}
</script>
<style lang="scss" scoped>
.checkbox {
display: flex;
align-items: center;
gap: 5px;
cursor: pointer;
&.isAccent {
& .checkbox__block {
border: 2px solid $accentDark;
border-radius: $default_border_radius;
}
& .checkbox__label {
color: $accentDark;
font-weight: 600;
}
}
&__input {
display: none;
opacity: 0;
}
&__block {
cursor: pointer;
display: inline-block;
width: 20px;
height: 20px;
border: 2px solid $black;
border-radius: $default_border_radius;
position: relative;
&::after {
content: "";
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 10px;
height: 10px;
background-color: $accent;
border-radius: 2px;
opacity: 0;
}
}
&__label {
cursor: pointer;
color: #2B2B2B;
font-size: 12px;
font-weight: 500;
line-height: 16px;
}
}
.checkbox__input:checked + .checkbox__block::after {
opacity: 1;
}
</style>