feat(docs): document layout section component
This commit is contained in:
parent
90ae581379
commit
2c078236d7
|
@ -30,6 +30,7 @@ import useOrdering from '~/composables/navigation/useOrdering'
|
||||||
import useErrorHandler from '~/composables/useErrorHandler'
|
import useErrorHandler from '~/composables/useErrorHandler'
|
||||||
import usePage from '~/composables/navigation/usePage'
|
import usePage from '~/composables/navigation/usePage'
|
||||||
import useLogger from '~/composables/useLogger'
|
import useLogger from '~/composables/useLogger'
|
||||||
|
import Section from '../ui/layout/Section.vue'
|
||||||
|
|
||||||
interface Props extends OrderingProps {
|
interface Props extends OrderingProps {
|
||||||
scope?: 'me' | 'all'
|
scope?: 'me' | 'all'
|
||||||
|
@ -126,6 +127,9 @@ const paginateOptions = computed(() => sortedUniq([12, 30, 50, paginateBy.value]
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
<Section h1="">
|
||||||
|
|
||||||
|
</Section>
|
||||||
<Layout stack main v-title="labels.title">
|
<Layout stack main v-title="labels.title">
|
||||||
<h2>
|
<h2>
|
||||||
{{ t('components.library.Artists.header.browse') }}
|
{{ t('components.library.Artists.header.browse') }}
|
||||||
|
|
|
@ -8,8 +8,6 @@ import { type AlignmentProps, align } from '~/composables/alignment'
|
||||||
import Loader from '~/components/ui/Loader.vue'
|
import Loader from '~/components/ui/Loader.vue'
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
alignText?: 'left' | 'center' | 'right'
|
|
||||||
alignSelf?: 'start' | 'center' | 'end' | 'baseline'
|
|
||||||
thin?: true
|
thin?: true
|
||||||
|
|
||||||
isActive?: boolean
|
isActive?: boolean
|
||||||
|
|
|
@ -1,14 +1,10 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed } from 'vue';
|
import type { RouterLinkProps } from 'vue-router'
|
||||||
import type { RouterLinkProps } from 'vue-router';
|
|
||||||
|
|
||||||
import Card from '~/components/ui/Card.vue'
|
|
||||||
import Layout from '~/components/ui/Layout.vue'
|
import Layout from '~/components/ui/Layout.vue'
|
||||||
import Toggle from '~/components/ui/Toggle.vue'
|
|
||||||
import Spacer from '~/components/ui/layout/Spacer.vue'
|
import Spacer from '~/components/ui/layout/Spacer.vue'
|
||||||
import Button from '~/components/ui/Button.vue'
|
import Button from '~/components/ui/Button.vue'
|
||||||
import Link from '~/components/ui/Link.vue'
|
import Link from '~/components/ui/Link.vue'
|
||||||
import Activity from '~/components/ui/Activity.vue'
|
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
[M in 'tiny-items' | 'small-items' | 'medium-items']?: true }
|
[M in 'tiny-items' | 'small-items' | 'medium-items']?: true }
|
||||||
|
|
|
@ -108,6 +108,84 @@ const user: User = {
|
||||||
|
|
||||||
# Layout section
|
# Layout section
|
||||||
|
|
||||||
|
## Alignment
|
||||||
|
|
||||||
|
```vue-html
|
||||||
|
<Section alignLeft />
|
||||||
|
```
|
||||||
|
|
||||||
|
## Item width
|
||||||
|
|
||||||
|
Do you want to align the header to tiny, small or medium items?
|
||||||
|
|
||||||
|
```vue-html
|
||||||
|
<Section medium-items />
|
||||||
|
```
|
||||||
|
|
||||||
|
## Heading
|
||||||
|
|
||||||
|
`h1` or `h2` or `h3` `="title"`
|
||||||
|
|
||||||
|
```vue-html
|
||||||
|
<Section h3="My title" />
|
||||||
|
```
|
||||||
|
|
||||||
|
## Action
|
||||||
|
|
||||||
|
Will be shown on the right side of the header
|
||||||
|
|
||||||
|
### (a) Add a link:
|
||||||
|
|
||||||
|
```vue-html
|
||||||
|
<Section :action="{ text:'more...', to:'/' }" />
|
||||||
|
```
|
||||||
|
|
||||||
|
### (b) Or a button:
|
||||||
|
|
||||||
|
```vue-html
|
||||||
|
<Section :action="{ text:'more...', onClick:'loadMore' }" />
|
||||||
|
```
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
```vue-html
|
||||||
|
<Layout flex>
|
||||||
|
<Toggle v-model="alignLeft" label="Left-align the layout"/>
|
||||||
|
</Layout>
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
<div class="preview" style="margin: 0 -40px; padding: 0 25px;">
|
||||||
|
|
||||||
|
<LayoutSection :alignLeft="alignLeft" small-items h3="Cards (small items)" :action="{ text:'more...', to:'/' }">
|
||||||
|
<Card small title="Relatively Long Album Name">
|
||||||
|
Artist Name
|
||||||
|
13 tracks
|
||||||
|
</Card>
|
||||||
|
<Card small title="Relatively Long Album Name">
|
||||||
|
Artist Name
|
||||||
|
13 tracks
|
||||||
|
</Card>
|
||||||
|
<Card small title="Relatively Long Album Name">
|
||||||
|
Artist Name
|
||||||
|
13 tracks
|
||||||
|
</Card>
|
||||||
|
</LayoutSection>
|
||||||
|
|
||||||
|
<LayoutSection
|
||||||
|
:alignLeft="alignLeft"
|
||||||
|
medium-items
|
||||||
|
h3="Activities (medium items)"
|
||||||
|
:action="{ text:'more...', to:'/' }"
|
||||||
|
>
|
||||||
|
<Activity :track="track" :user="user" />
|
||||||
|
<Activity :track="track" :user="user" />
|
||||||
|
<Activity :track="track" :user="user" />
|
||||||
|
</LayoutSection>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
```
|
||||||
|
|
||||||
<Layout flex>
|
<Layout flex>
|
||||||
<Toggle v-model="alignLeft" label="Left-align the layout"/>
|
<Toggle v-model="alignLeft" label="Left-align the layout"/>
|
||||||
</Layout>
|
</Layout>
|
||||||
|
|
Loading…
Reference in New Issue