docs(ui-docs)

This commit is contained in:
upsiflu 2025-01-20 18:52:52 +02:00
parent 83023aaeb1
commit 6daf2952ec
2 changed files with 16 additions and 26 deletions

View File

@ -4,7 +4,7 @@ import Button from "~/components/ui/Button.vue"
</script> </script>
```ts ```ts
import Alert from "~/components/ui/Alert.vue" import Alert from "~/components/ui/Alert.vue";
``` ```
# Alert # Alert
@ -79,10 +79,9 @@ Funkwhale alerts support a range of pastel colors for visual appeal.
## Alert actions ## Alert actions
```vue-html{2-4} ```vue-html{3-6}
<Alert blue> <Alert blue>
Awesome artist Awesome artist
<template #actions> <template #actions>
<Button disabled>Deny</Button> <Button disabled>Deny</Button>
<Button>Got it</Button> <Button>Got it</Button>

View File

@ -1,5 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { computed, ref } from 'vue' import { ref } from 'vue'
import { type Track, type User } from '~/types' import { type Track, type User } from '~/types'
@ -102,7 +102,7 @@ const user: User = {
</script> </script>
```ts ```ts
import Section from "~/components/ui/Section.vue" import Section from "~/components/ui/Section.vue";
``` ```
# Layout section # Layout section
@ -162,36 +162,29 @@ You can add props to the Link or Button, for example to make them `primary` or a
<Section solid primary icon="bi-star" <Section solid primary icon="bi-star"
h3="Example" :action="{ text:'Say hello!', onClick:()=>console.log('Hello') }" /> h3="Example" :action="{ text:'Say hello!', onClick:()=>console.log('Hello') }" />
::: tip Gaps between consecutive sections ## Set gaps between consecutive sections
Place consecutive sections into a [Layout stack](../layout) width a size of 64px give them a regular vertical rhythm. Use different sizes for very small or very large headings. Place consecutive sections into a [Layout stack](../layout) with a 64px gap (`gap-64`) to give them a regular vertical rhythm. Use different sizes for very small or very large headings.
You can add spacers with negative or positive size if you want to manually make a specific distance smaller or larger than the others.
Note the spacer above the layout. By default, sections begin at the baseline of the heading. This enables us to explicitly define the vertical rhythm, independently of the heading's line height.
```vue-html ```vue-html
<Spacer/>
<Layout stack gap-64> <Layout stack gap-64>
<Spacer />
<Section h3="Section 1" /> <Section h3="Section 1" />
<Section h3="Section 2" /> <Section h3="Section 2" />
</Layout> </Layout>
``` ```
<Spacer />
<Layout stack gap-64> <Layout stack gap-64>
<Spacer no-size />
<Section h3="Section 1" /> <Section h3="Section 1" />
<Section h3="Section 2" /> <Section h3="Section 2" />
</Layout> </Layout>
<Spacer /> <Spacer />
::: ## Mix sections of different item widths
::: tip Let items cover the whole grid width
To prevent items from being put on a grid, add `style="grid-column: 1 / -1"` which means that they span "all existing columns".
:::
## Example
```vue-html ```vue-html
<Layout flex> <Layout flex>
@ -259,9 +252,7 @@ To prevent items from being put on a grid, add `style="grid-column: 1 / -1"` whi
## Responsivity ## Responsivity
- Cards and Activities snap to the grid columns. They have intrinsic widths, expressed in the number of columns they span. For Card, it is 3 and for Activity, it is 4. - Cards and Activities snap to the grid columns. They have intrinsic widths, expressed in the number of columns they span. For `Card`, it is `3` and for `Activity`, it is `4`.
- On a typical laptop screen, you will have 4 albums or 3 activities side-by-side. On a typical mobile screen, you will have 1 medium card or 2 small ones in a row. - On a typical laptop screen, you may have 4 album cards or 3 activities side-by-side. On a typical mobile screen, you will have one medium card or two small ones in a row.
- The remaining space is evenly distributed. - The remaining space is evenly distributed.
- Title rows align with the content below them. - Title rows align with the content below them. The action on the right will always end with the last item in the grid. Resize the window to observe how the items move.
Resize the window to observe how the items move.