koel/resources/assets/js/components/ui/ScreenHeader.vue

98 lines
2.1 KiB
Vue
Raw Normal View History

2022-04-15 14:24:30 +00:00
<template>
2024-04-04 22:20:42 +00:00
<header
2024-04-23 21:01:27 +00:00
:class="[ layout, disabled ? 'disabled' : '' ]"
2024-04-04 22:20:42 +00:00
class="screen-header min-h-0 md:min-h-full flex items-end flex-shrink-0 relative content-stretch leading-normal p-6
border-b border-b-k-bg-secondary"
>
<aside v-if="$slots.thumbnail" class="thumbnail-wrapper hidden md:block overflow-hidden w-0 rounded-md">
2022-12-02 16:17:37 +00:00
<slot name="thumbnail" />
2022-07-30 15:08:20 +00:00
</aside>
2022-04-15 14:24:30 +00:00
2024-04-04 22:20:42 +00:00
<main class="flex flex-1 gap-5 items-center overflow-hidden">
<div class="w-full flex-1 overflow-hidden">
<h1 class="name overflow-hidden whitespace-nowrap text-ellipsis mr-4 font-thin md:font-bold my-0 leading-tight">
2022-12-02 16:17:37 +00:00
<slot />
2022-07-16 09:52:39 +00:00
</h1>
2024-04-04 22:20:42 +00:00
<span v-if="$slots.meta" class="meta text-k-text-secondary hidden text-[0.9rem] leading-loose">
2022-12-02 16:17:37 +00:00
<slot name="meta" />
2022-07-16 09:52:39 +00:00
</span>
</div>
2022-12-02 16:17:37 +00:00
<slot name="controls" />
2022-07-30 15:08:20 +00:00
</main>
2022-04-15 14:24:30 +00:00
</header>
</template>
2022-04-15 17:00:08 +00:00
<script lang="ts" setup>
2024-04-04 22:20:42 +00:00
withDefaults(defineProps<{
layout?: ScreenHeaderLayout,
disabled?: boolean,
}>(), {
layout: 'expanded',
disabled: false
})
2022-04-15 14:24:30 +00:00
</script>
2024-04-04 20:13:35 +00:00
<style lang="postcss" scoped>
2022-07-10 17:15:56 +00:00
header.screen-header {
2024-04-04 22:20:42 +00:00
--transition-duration: 300ms;
2022-07-16 15:44:45 +00:00
@media (prefers-reduced-motion) {
--transition-duration: 0;
}
&.disabled {
2024-04-04 22:20:42 +00:00
@apply opacity-50 cursor-not-allowed;
*, *::before, *::after {
2024-04-04 22:20:42 +00:00
@apply pointer-events-none;
}
}
2022-07-16 09:52:39 +00:00
&.expanded {
.thumbnail-wrapper {
2024-04-04 22:20:42 +00:00
@apply mr-6 w-[192px];
2022-07-16 09:52:39 +00:00
2022-07-16 15:44:45 +00:00
> * {
2024-04-04 22:20:42 +00:00
@apply scale-100;
2022-07-16 15:44:45 +00:00
}
2022-07-16 09:52:39 +00:00
}
.meta {
2024-04-04 22:20:42 +00:00
@apply block;
2022-07-16 09:52:39 +00:00
}
2022-07-30 15:08:20 +00:00
main {
2024-04-04 22:20:42 +00:00
@apply flex-col items-start;
2022-07-16 09:52:39 +00:00
}
}
2022-04-15 14:24:30 +00:00
2022-04-15 17:00:08 +00:00
.thumbnail-wrapper {
2022-07-16 15:44:45 +00:00
transition: width var(--transition-duration);
2022-04-15 14:24:30 +00:00
2022-07-16 15:44:45 +00:00
> * {
2024-04-04 22:20:42 +00:00
@apply scale-0 origin-bottom-left;
2022-07-16 15:44:45 +00:00
transition: transform var(--transition-duration), width var(--transition-duration);
}
2022-07-17 08:58:05 +00:00
&:empty {
2024-04-04 22:20:42 +00:00
@apply hidden;
2022-04-15 14:24:30 +00:00
}
}
2022-07-16 09:52:39 +00:00
h1.name {
font-size: clamp(1.8rem, 3vw, 4rem);
2022-04-15 14:24:30 +00:00
}
.meta {
a {
2024-04-04 22:20:42 +00:00
@apply text-k-text-primary hover:text-k-highlight;
2022-04-15 14:24:30 +00:00
}
2022-07-10 17:15:56 +00:00
2022-10-27 17:06:49 +00:00
> :slotted(* + *) {
2024-04-04 22:20:42 +00:00
@apply ml-1 inline-block before:content-['•'] before:mr-1 before:text-k-text-secondary;
2022-04-15 14:24:30 +00:00
}
}
}
</style>