From c65b4bd4f0c889f17fd91671351bef929bbc8412 Mon Sep 17 00:00:00 2001 From: upsiflu Date: Sun, 22 Dec 2024 02:27:20 +0100 Subject: [PATCH] feat(ui): more consistent props --- front/src/components/ui/Button.vue | 6 ++- front/src/components/ui/Card.vue | 37 ++++++++++++----- front/src/components/ui/Layout.vue | 6 ++- front/src/components/ui/Link.vue | 4 +- front/src/components/ui/Pill.vue | 3 +- front/src/components/ui/layout/Spacer.vue | 22 ++++++---- front/src/style/colors.scss | 8 ++-- front/src/ui/layouts/constrained.vue | 1 - front/ui-docs/components/ui/card.md | 42 ++++++++++---------- front/ui-docs/components/ui/layout.md | 10 ++--- front/ui-docs/components/ui/layout/flex.md | 8 +--- front/ui-docs/components/ui/layout/spacer.md | 14 ++++++- front/ui-docs/using-color.md | 8 +++- 13 files changed, 105 insertions(+), 64 deletions(-) diff --git a/front/src/components/ui/Button.vue b/front/src/components/ui/Button.vue index 24b902219..46d4d9199 100644 --- a/front/src/components/ui/Button.vue +++ b/front/src/components/ui/Button.vue @@ -90,9 +90,9 @@ onMounted(() => { line-height: 1em; - padding: 0.642857142857em 0.714em 0.714em 0.714em; + padding: 9px 10px 11px 10px; &.is-icon-only { - padding: 0.675em 0.714em 0.678em 0.714em; + padding: 10px; } border-radius: var(--fw-border-radius); @@ -161,6 +161,8 @@ onMounted(() => { &.large { font-size:2rem; } + /* Must not increase the height of the button */ + margin: -0.5rem 0; } i.bi + span:not(:empty) { diff --git a/front/src/components/ui/Card.vue b/front/src/components/ui/Card.vue index 3d45b9e51..15956d194 100644 --- a/front/src/components/ui/Card.vue +++ b/front/src/components/ui/Card.vue @@ -16,21 +16,35 @@ const props = defineProps<{ tags?: string[] image?: string | { src: string, style?: "withPadding" } icon?: string -} & ({ - [Width in 'small' | 'auto']?: true -} | { width: string }) & Partial & (PastelProps | ColorProps | DefaultProps) & RaisedProps & VariantProps>() +} & ( + { [Width in 'large' | 'medium' | 'small' | 'auto']?: true } | { width?: string } +) & Partial & (PastelProps | ColorProps | DefaultProps) & RaisedProps & VariantProps>() const image = typeof props.image === 'string' ? { src: props.image } : props.image +const width = + 'width' in props && props.width + ? props.width + : 'auto' in props && props.auto + ? 'auto' + : 'large' in props && props.large ? + '304px' + : 'medium' in props && props.medium ? + '208px' + : 'small' in props && props.small ? + 'min-content' + : '304px' + +console.log("WIDTH", width, props) + const isExternalLink = computed(() => { return typeof props.to === 'string' && props.to.startsWith('http') }) diff --git a/front/ui-docs/components/ui/card.md b/front/ui-docs/components/ui/card.md index fb616aaf1..f736bfb43 100644 --- a/front/ui-docs/components/ui/card.md +++ b/front/ui-docs/components/ui/card.md @@ -99,34 +99,34 @@ Category cards are basic cards that contain only a title. To create a category c Pass an image source to the `image` prop or set both `image.src` and `image.style` by passing an object. - + + +
```vue-html{4,11-12} - /> - ``` +
+ - - @@ -212,7 +212,7 @@ Large Buttons or links at the bottom edge of the card serve as Call-to-Actions ( The easiest way to get started with Funkwhale is to register an account on a public pod. @@ -222,7 +222,7 @@ Large Buttons or links at the bottom edge of the card serve as Call-to-Actions ( The easiest way to get started with Funkwhale is to register an account on a public pod. @@ -231,28 +231,28 @@ Large Buttons or links at the bottom edge of the card serve as Call-to-Actions ( If there are multiple actions, they will be presented in a row: ```vue-html{4,7} - - You cannot undo this action. + + All items have been assimilated. Ready to go! ```
- - You cannot undo this action. + + All items have been assimilated. Ready to go! diff --git a/front/ui-docs/components/ui/layout.md b/front/ui-docs/components/ui/layout.md index 206d93660..82a825f9c 100644 --- a/front/ui-docs/components/ui/layout.md +++ b/front/ui-docs/components/ui/layout.md @@ -18,28 +18,28 @@ const noGap = ref(true) The following containers are responsive. Change your window's size or select a device preset from your browser's dev tools to see how layouts are affected by available space. - - + +
-## Make the Spacer elastic +## Make the Spacer elastic (responsive) @@ -154,3 +154,15 @@ const size = ref(1); + +## Use the Spacer to vary an element's dimensions + + + + + + + + + + diff --git a/front/ui-docs/using-color.md b/front/ui-docs/using-color.md index 4d269795c..0ca33f20d 100644 --- a/front/ui-docs/using-color.md +++ b/front/ui-docs/using-color.md @@ -13,11 +13,17 @@ const route = useRoute(); const here = route.path -Want to fix colors? + +Want to fix colors? + + Change a color value Alter the shade of a color Modify a specific variant + + + # Using Color ## Add color via props