refactor(ui): alignment props for alerts and buttons
This commit is contained in:
parent
15bd54ab5f
commit
6a75aef93f
|
@ -21,7 +21,7 @@ withDefaults(defineProps<Props>(), {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<Alert blue style="text-align: center;">
|
<Alert blue align-items="center">
|
||||||
<h4 class="ui header">
|
<h4 class="ui header">
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<slot name="title">
|
<slot name="title">
|
||||||
|
|
|
@ -190,7 +190,7 @@ const paginateOptions = computed(() => sortedUniq([12, 25, 50, paginateBy.value]
|
||||||
:tracks="results"
|
:tracks="results"
|
||||||
/>
|
/>
|
||||||
</Layout>
|
</Layout>
|
||||||
<Alert blue style="text-align: center;"
|
<Alert blue align-items="center"
|
||||||
v-else
|
v-else
|
||||||
>
|
>
|
||||||
<i class="bi bi-heartbreak-fill" style="font-size: 100px;" />
|
<i class="bi bi-heartbreak-fill" style="font-size: 100px;" />
|
||||||
|
@ -202,7 +202,6 @@ const paginateOptions = computed(() => sortedUniq([12, 25, 50, paginateBy.value]
|
||||||
solid
|
solid
|
||||||
primary
|
primary
|
||||||
icon="bi-headphones"
|
icon="bi-headphones"
|
||||||
align-self="center"
|
|
||||||
>
|
>
|
||||||
{{ t('components.favorites.List.link.library') }}
|
{{ t('components.favorites.List.link.library') }}
|
||||||
</Link>
|
</Link>
|
||||||
|
|
|
@ -9,9 +9,13 @@ const props = defineProps<Props>()
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div
|
<div
|
||||||
class="funkwhale is-colored solid alert"
|
class="funkwhale alert"
|
||||||
role="alert"
|
role="alert"
|
||||||
v-bind="color(align(props)())"
|
v-bind="{
|
||||||
|
...$attrs,
|
||||||
|
...color(props, ['solid'])(
|
||||||
|
align(props)(
|
||||||
|
))}"
|
||||||
>
|
>
|
||||||
<slot />
|
<slot />
|
||||||
|
|
||||||
|
|
|
@ -72,7 +72,7 @@ onMounted(() => {
|
||||||
...$attrs,
|
...$attrs,
|
||||||
...color(props, ['interactive'])(
|
...color(props, ['interactive'])(
|
||||||
width(props, isIconOnly ? ['square'] : ['normalHeight', 'buttonWidth'])(
|
width(props, isIconOnly ? ['square'] : ['normalHeight', 'buttonWidth'])(
|
||||||
align(props, { alignSelf:'start', alignText:'center' })(
|
align(props, { alignText:'center' })(
|
||||||
)))}"
|
)))}"
|
||||||
class="funkwhale button split-main"
|
class="funkwhale button split-main"
|
||||||
:autofocus="autofocus || undefined"
|
:autofocus="autofocus || undefined"
|
||||||
|
|
|
@ -1,37 +1,4 @@
|
||||||
.funkwhale.alert {
|
.funkwhale.alert {
|
||||||
// color: var(--fw-gray-900);
|
|
||||||
|
|
||||||
// @include light-theme {
|
|
||||||
// background-color: var(--fw-pastel-1, var(--fw-bg-color));
|
|
||||||
|
|
||||||
// > .actions .funkwhale.button {
|
|
||||||
// --fw-bg-color: var(--fw-pastel-2);
|
|
||||||
|
|
||||||
// &:hover, &.is-hovered {
|
|
||||||
// --fw-bg-color: var(--fw-pastel-3);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// &:active, &.is-active {
|
|
||||||
// --fw-bg-color: var(--fw-pastel-4);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// @include dark-theme {
|
|
||||||
// background-color: var(--fw-pastel-3, var(--fw-bg-color));
|
|
||||||
|
|
||||||
// > .actions .funkwhale.button {
|
|
||||||
// --fw-bg-color: var(--fw-pastel-4);
|
|
||||||
|
|
||||||
// &:hover, &.is-hovered {
|
|
||||||
// --fw-bg-color: var(--fw-pastel-2);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// &:active, &.is-active {
|
|
||||||
// --fw-bg-color: var(--fw-pastel-1);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
padding: 2rem 2rem;
|
padding: 2rem 2rem;
|
||||||
line-height: 1.2;
|
line-height: 1.2;
|
||||||
|
|
|
@ -3,7 +3,8 @@ import type { HTMLAttributes } from "vue";
|
||||||
|
|
||||||
export type AlignmentProps = {
|
export type AlignmentProps = {
|
||||||
alignText?: 'left' | 'center' | 'right' | 'stretch' | 'space-out',
|
alignText?: 'left' | 'center' | 'right' | 'stretch' | 'space-out',
|
||||||
alignSelf?: 'start' | 'center' | 'end' | 'auto' | 'baseline' | 'stretch'
|
alignSelf?: 'start' | 'center' | 'end' | 'auto' | 'baseline' | 'stretch',
|
||||||
|
alignItems?: 'start' | 'center' | 'end' | 'auto' | 'baseline' | 'stretch'
|
||||||
} & {
|
} & {
|
||||||
[T in 'center' | 'stretch']?: true
|
[T in 'center' | 'stretch']?: true
|
||||||
}
|
}
|
||||||
|
@ -14,7 +15,7 @@ const styles = {
|
||||||
stretch: 'place-content: stretch stretch; place-self: stretch stretch;',
|
stretch: 'place-content: stretch stretch; place-self: stretch stretch;',
|
||||||
alignText: (a:AlignmentProps['alignText'])=>({
|
alignText: (a:AlignmentProps['alignText'])=>({
|
||||||
left: 'justify-content: flex-start;',
|
left: 'justify-content: flex-start;',
|
||||||
center: 'justify-content: center;',
|
center: 'place-content: center;',
|
||||||
baseline: 'align-items: baseline;',
|
baseline: 'align-items: baseline;',
|
||||||
right: 'justify-content: flex-end;',
|
right: 'justify-content: flex-end;',
|
||||||
stretch: 'place-content: stretch;',
|
stretch: 'place-content: stretch;',
|
||||||
|
@ -27,6 +28,14 @@ const styles = {
|
||||||
auto: 'align-self: auto;',
|
auto: 'align-self: auto;',
|
||||||
baseline: 'align-self: baseline;',
|
baseline: 'align-self: baseline;',
|
||||||
stretch: 'align-self: stretch;'
|
stretch: 'align-self: stretch;'
|
||||||
|
}[a!]),
|
||||||
|
alignItems: (a:AlignmentProps['alignSelf'])=> ({
|
||||||
|
start: 'align-items: flex-start;',
|
||||||
|
center: 'align-items: center;',
|
||||||
|
end: 'align-items: flex-end;',
|
||||||
|
auto: 'align-items: auto;',
|
||||||
|
baseline: 'align-items: baseline;',
|
||||||
|
stretch: 'align-items: stretch;'
|
||||||
}[a!])
|
}[a!])
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
|
|
|
@ -229,10 +229,12 @@ const getImportStatusChoice = (importStatus: ImportStatus) => {
|
||||||
<Alert
|
<Alert
|
||||||
v-else-if="!result || result?.results.length === 0 && !needsRefresh"
|
v-else-if="!result || result?.results.length === 0 && !needsRefresh"
|
||||||
blue
|
blue
|
||||||
align-text="center"
|
align-items="center"
|
||||||
>
|
>
|
||||||
<i class="bi bi-upload" />
|
<i class="bi bi-upload" />
|
||||||
|
<span>
|
||||||
{{ t('views.content.libraries.FilesTable.empty.noTracks') }}
|
{{ t('views.content.libraries.FilesTable.empty.noTracks') }}
|
||||||
|
</span>
|
||||||
</Alert>
|
</Alert>
|
||||||
<action-table
|
<action-table
|
||||||
v-else
|
v-else
|
||||||
|
|
|
@ -21,6 +21,7 @@ import Spacer from '~/components/ui/Spacer.vue'
|
||||||
import Loader from '~/components/ui/Loader.vue'
|
import Loader from '~/components/ui/Loader.vue'
|
||||||
import Button from '~/components/ui/Button.vue'
|
import Button from '~/components/ui/Button.vue'
|
||||||
import Modal from '~/components/ui/Modal.vue'
|
import Modal from '~/components/ui/Modal.vue'
|
||||||
|
import Alert from '~/components/ui/Alert.vue'
|
||||||
|
|
||||||
import PlaylistDropdown from '~/components/playlists/PlaylistDropdown.vue'
|
import PlaylistDropdown from '~/components/playlists/PlaylistDropdown.vue'
|
||||||
|
|
||||||
|
@ -237,10 +238,15 @@ const deletePlaylist = async () => {
|
||||||
</template>
|
</template>
|
||||||
<Alert blue
|
<Alert blue
|
||||||
v-else
|
v-else
|
||||||
|
align-items="center"
|
||||||
>
|
>
|
||||||
|
<Layout flex :gap="8">
|
||||||
<i class="bi bi-music-note-list" />
|
<i class="bi bi-music-note-list" />
|
||||||
{{ t('views.playlists.Detail.empty.noTracks') }}
|
{{ t('views.playlists.Detail.empty.noTracks') }}
|
||||||
|
</Layout>
|
||||||
|
<Spacer size-16 />
|
||||||
<Button
|
<Button
|
||||||
|
primary
|
||||||
icon="bi-pencil"
|
icon="bi-pencil"
|
||||||
@click="edit = !edit"
|
@click="edit = !edit"
|
||||||
>
|
>
|
||||||
|
|
Loading…
Reference in New Issue