1
0
Fork 1
mirror of https://github.com/elk-zone/elk.git synced 2024-11-19 15:29:59 +00:00
elk/components/settings/SettingsToggleItem.vue

48 lines
1.3 KiB
Vue
Raw Normal View History

2022-12-27 17:38:38 +00:00
<script setup lang="ts">
2023-02-15 10:34:23 +00:00
const { disabled = false } = defineProps<{
2022-12-27 17:38:38 +00:00
icon?: string
text?: string
checked: boolean
2023-02-15 10:34:23 +00:00
disabled?: boolean
2022-12-27 17:38:38 +00:00
}>()
</script>
<template>
<button
exact-active-class="text-primary"
block w-full group focus:outline-none text-start
2023-02-15 10:34:23 +00:00
:disabled="disabled"
:class="disabled ? 'opacity-50 cursor-not-allowed' : ''"
2022-12-27 17:38:38 +00:00
>
<div
w-full flex w-fit px5 py3 md:gap2 gap4 items-center
2023-02-15 10:34:23 +00:00
transition-250
:class="disabled ? '' : 'group-hover:bg-active'"
2022-12-27 17:38:38 +00:00
group-focus-visible:ring="2 current"
>
<div flex-1 flex items-center md:gap2 gap4>
<div
v-if="icon" flex items-center justify-center
flex-shrink-0
2022-12-27 17:38:38 +00:00
:class="$slots.description ? 'w-12 h-12' : ''"
>
<slot name="icon">
<div v-if="icon" :class="icon" md:text-size-inherit text-xl />
</slot>
</div>
<div space-y-1>
<p :class="checked ? 'text-base' : 'text-secondary'">
<slot>
<span>{{ text }}</span>
</slot>
</p>
<p v-if="$slots.description" text-sm text-secondary>
<slot name="description" />
</p>
</div>
</div>
<div text-lg :class="checked ? 'i-ri-checkbox-line text-primary' : 'i-ri-checkbox-blank-line text-secondary'" />
</div>
</button>
</template>