From 1b5cfc721564e59b00ff889d55b1494414660f62 Mon Sep 17 00:00:00 2001 From: upsiflu Date: Tue, 17 Dec 2024 23:09:10 +0100 Subject: [PATCH] feat(ui): add more style props to Button --- front/src/components/ui/Button.vue | 51 +++++++++++++++++---------- front/ui-docs/components/ui/button.md | 43 ++++++++++++++++++++-- 2 files changed, 74 insertions(+), 20 deletions(-) diff --git a/front/src/components/ui/Button.vue b/front/src/components/ui/Button.vue index 5aa3c0e5e..a34d3a6a1 100644 --- a/front/src/components/ui/Button.vue +++ b/front/src/components/ui/Button.vue @@ -4,9 +4,11 @@ import { type ColorProps, type VariantProps, type DefaultProps, propsToColor } f import Loader from '~/components/ui/Loader.vue' -type Props = { +const props = defineProps<{ width?: 'standard' | 'auto' | 'full' alignText?: 'left' | 'center' | 'right' + alignSelf?: 'start' | 'center' | 'end' + thin?: true isActive?: boolean isLoading?: boolean @@ -19,9 +21,7 @@ type Props = { autofocus? : boolean ariaPressed? : true -} & ColorProps & VariantProps & DefaultProps - -const props = defineProps() +} & (ColorProps | DefaultProps) & VariantProps>() const slots = useSlots() const isIconOnly = computed(() => !!props.icon && !slots.default) @@ -29,6 +29,8 @@ const isIconOnly = computed(() => !!props.icon && !slots.default) const internalLoader = ref(false) const isLoading = computed(() => props.isLoading || internalLoader.value) +const fontWeight = props.thin ? 400 : 900 + const button = ref() const click = async (...args: any[]) => { @@ -49,10 +51,11 @@ onMounted(() => { + + + +## Width and alignment + + + +```vue-html + + + + +
+ + + + + +
+ + + + +``` + + + + + +
+ + + +
+ + + + (Text to stretch the column) +
+