Move all base components to an isolated folder

This commit is contained in:
Peaceultime 2024-11-04 13:34:23 +01:00
parent 8a19448a38
commit 5ce2d3e236
27 changed files with 28 additions and 11 deletions

View File

@ -16,7 +16,7 @@
<Icon icon="radix-icons:chevron-up" /> <Icon icon="radix-icons:chevron-up" />
</SelectScrollUpButton> </SelectScrollUpButton>
<SelectViewport class="p-1"> <SelectViewport class="p-1">
<slot></slot> <slot />
</SelectViewport> </SelectViewport>
<SelectScrollDownButton> <SelectScrollDownButton>
<Icon icon="radix-icons:chevron-down" /> <Icon icon="radix-icons:chevron-down" />

View File

@ -1,7 +1,7 @@
<template> <template>
<SelectGroup :disabled="disabled" class=""> <SelectGroup :disabled="disabled" class="">
<SelectLabel class="">{{ label }}</SelectLabel> <SelectLabel class="">{{ label }}</SelectLabel>
<slot></slot> <slot />
</SelectGroup> </SelectGroup>
</template> </template>

View File

@ -1,8 +1,8 @@
<template> <template>
<Label class="flex justify-center items-center my-2">{{ label }} <Label class="flex justify-center items-center my-2">{{ label }}
<SwitchRoot v-model:checked="model" :disabled="disabled" <SwitchRoot v-model:checked="model" :disabled="disabled"
class="mx-3 w-12 h-6 select-none transition-colors border border-light-35 dark:border-dark-35 bg-light-20 dark:bg-dark-20 outline-none class="mx-3 w-12 h-6 select-none transition-all border border-light-35 dark:border-dark-35 bg-light-20 dark:bg-dark-20 outline-none
data-[state=checked]:bg-light-35 dark:data-[state=checked]:bg-dark-35 hover:border-light-50 dark:hover:border-dark-50 focus:shadow-raw transition-[box-shadow] focus:shadow-light-40 dark:focus:shadow-dark-40 data-[state=checked]:bg-light-35 dark:data-[state=checked]:bg-dark-35 hover:border-light-50 dark:hover:border-dark-50 focus:shadow-raw focus:shadow-light-40 dark:focus:shadow-dark-40
data-[disabled]:bg-light-20 dark:data-[disabled]:bg-dark-20 data-[disabled]:border-light-20 dark:data-[disabled]:border-dark-20"> data-[disabled]:bg-light-20 dark:data-[disabled]:bg-dark-20 data-[disabled]:border-light-20 dark:data-[disabled]:border-dark-20">
<SwitchThumb <SwitchThumb
class="block w-[18px] h-[18px] translate-x-[2px] will-change-transform transition-transform bg-light-50 dark:bg-dark-50 data-[state=checked]:translate-x-[26px] class="block w-[18px] h-[18px] translate-x-[2px] will-change-transform transition-transform bg-light-50 dark:bg-dark-50 data-[state=checked]:translate-x-[26px]
@ -12,9 +12,11 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
const { label, disabled } = defineProps<{ const { label, disabled, onIcon, offIcon } = defineProps<{
label?: string label?: string
disabled?: boolean disabled?: boolean
onIcon?: string
offIcon?: string
}>(); }>();
const model = defineModel<boolean>(); const model = defineModel<boolean>();
</script> </script>

View File

@ -1,5 +1,5 @@
<template> <template>
<Label class="px-4 my-2">{{ label }} <Label class="my-2">{{ label }}
<input :placeholder="placeholder" :disabled="disabled" <input :placeholder="placeholder" :disabled="disabled"
class="mx-4 caret-light-50 dark:caret-dark-50 text-light-100 dark:text-dark-100 placeholder:text-light-50 dark:placeholder:text-dark-50 class="mx-4 caret-light-50 dark:caret-dark-50 text-light-100 dark:text-dark-100 placeholder:text-light-50 dark:placeholder:text-dark-50
bg-light-20 dark:bg-dark-20 appearance-none outline-none px-3 py-1 focus:shadow-raw transition-[box-shadow] focus:shadow-light-40 dark:focus:shadow-dark-40 bg-light-20 dark:bg-dark-20 appearance-none outline-none px-3 py-1 focus:shadow-raw transition-[box-shadow] focus:shadow-light-40 dark:focus:shadow-dark-40

View File

@ -5,7 +5,7 @@
<ToastClose v-if="closeable" aria-label="Close" class="text-2xl -translate-y-1/2 translate-x-1/2 cursor-pointer"><span aria-hidden>×</span></ToastClose> <ToastClose v-if="closeable" aria-label="Close" class="text-2xl -translate-y-1/2 translate-x-1/2 cursor-pointer"><span aria-hidden>×</span></ToastClose>
<ToastDescription v-if="content" class="text-md col-span-8 text-light-70 dark:text-dark-70" asChild><span>{{ content }}</span></ToastDescription> <ToastDescription v-if="content" class="text-md col-span-8 text-light-70 dark:text-dark-70" asChild><span>{{ content }}</span></ToastDescription>
</div> </div>
<TimerProgress v-if="timer" shape="thin" :delay="duration" class="mb-0 mt-0 w-full" /> <TimerProgress v-if="timer" shape="thin" :delay="duration" class="mb-0 mt-0 w-full" />
</ToastRoot> </ToastRoot>
<ToastViewport class="fixed bottom-0 right-0 flex flex-col p-6 gap-2 max-w-[512px] z-50 outline-none min-w-72" /> <ToastViewport class="fixed bottom-0 right-0 flex flex-col p-6 gap-2 max-w-[512px] z-50 outline-none min-w-72" />
@ -21,6 +21,21 @@ const { closeable = true, duration, title, content, timer = true } = defineProps
content?: string content?: string
timer?: boolean timer?: boolean
}>(); }>();
const timeout = ref<NodeJS.Timeout>();
watch(model, (value) => {
if(duration)
{
if(value === true)
{
timeout.value = setTimeout(() => model.value = false, duration);
}
else
{
clearTimeout(timeout.value);
}
}
})
</script> </script>
<style> <style>

View File

@ -104,13 +104,13 @@ export default defineNuxtConfig({
app: { app: {
pageTransition: false, pageTransition: false,
layoutTransition: false layoutTransition: false
}/*, },
components: [ components: [
{ {
path: '~/components', path: '~/components',
pathPrefix: false, pathPrefix: false,
}, },
]*/, ],
security: { security: {
rateLimiter: false, rateLimiter: false,
headers: { headers: {

View File

@ -16,8 +16,8 @@ watch(loading, (value) => {
<div class="h-100 w-100 flex flex-1 flex-col justify-center items-center"> <div class="h-100 w-100 flex flex-1 flex-col justify-center items-center">
<div class="w-1/2 flex flex-1 flex-col justify-center items-center gap-2"> <div class="w-1/2 flex flex-1 flex-col justify-center items-center gap-2">
<Collapsible label="Options"> <Collapsible label="Options">
<div class="flex flex-col"> <div class="flex flex-col justify-start items-start">
<Switch label="Test" v-model="disabled" /> <Switch label="Verrouiler" v-model="disabled" />
<SliderInput :disabled="disabled" :label="`Prix: ${price.toFixed(2)}€`" :min="0" :max="1500" :step="0.25" <SliderInput :disabled="disabled" :label="`Prix: ${price.toFixed(2)}€`" :min="0" :max="1500" :step="0.25"
v-model="price" /> v-model="price" />
<TextInput label="Saisir un pseudonyme" :disabled="disabled" v-model="username" /> <TextInput label="Saisir un pseudonyme" :disabled="disabled" v-model="username" />