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

156 lines
2.8 KiB
Vue
Raw Normal View History

2022-04-15 14:24:30 +00:00
<template>
2022-07-16 09:52:39 +00:00
<header class="screen-header" :class="layout">
2022-04-21 10:18:11 +00:00
<div class="thumbnail-wrapper" :class="{ 'non-empty': hasThumbnail }">
2022-04-15 14:24:30 +00:00
<slot name="thumbnail"></slot>
</div>
2022-07-16 09:52:39 +00:00
<div class="right">
<div class="heading-wrapper">
<h1 class="name">
<slot></slot>
</h1>
<span class="meta text-secondary">
<slot name="meta"></slot>
</span>
</div>
<slot name="controls"></slot>
2022-04-15 14:24:30 +00:00
</div>
</header>
</template>
2022-04-15 17:00:08 +00:00
<script lang="ts" setup>
2022-04-21 10:18:11 +00:00
import { toRefs } from 'vue'
2022-04-15 14:24:30 +00:00
2022-07-16 09:52:39 +00:00
const props = withDefaults(defineProps<{ hasThumbnail?: boolean, layout?: 'expanded' | 'collapsed' }>(), {
hasThumbnail: false,
layout: 'expanded'
})
2022-04-21 10:18:11 +00:00
const { hasThumbnail } = toRefs(props)
2022-04-15 14:24:30 +00:00
</script>
2022-07-10 17:15:56 +00:00
<style lang="scss">
header.screen-header {
2022-07-16 15:44:45 +00:00
--transition-duration: .3s;
@media (prefers-reduced-motion) {
--transition-duration: 0;
}
2022-04-15 14:24:30 +00:00
display: flex;
2022-07-16 09:52:39 +00:00
align-items: flex-end;
2022-04-15 14:24:30 +00:00
border-bottom: 1px solid var(--color-bg-secondary);
position: relative;
align-content: stretch;
line-height: normal;
2022-07-16 15:44:45 +00:00
padding: 1.8rem;
2022-07-16 09:52:39 +00:00
&.expanded {
.thumbnail-wrapper {
2022-07-16 15:44:45 +00:00
margin-right: 1.5rem;
2022-07-16 09:52:39 +00:00
width: 192px;
2022-07-16 15:44:45 +00:00
> * {
transform: scale(1);
}
2022-07-16 09:52:39 +00:00
}
.meta {
display: block;
}
.right {
flex-direction: column;
align-items: flex-start;
}
}
2022-04-15 14:24:30 +00:00
2022-04-15 17:00:08 +00:00
.thumbnail-wrapper {
2022-07-16 09:52:39 +00:00
overflow: hidden;
2022-04-15 14:24:30 +00:00
display: none;
2022-07-16 15:44:45 +00:00
width: 0;
transition: width var(--transition-duration);
2022-07-16 09:52:39 +00:00
box-shadow: 0 10px 20px 0 rgba(0, 0, 0, 0.3);
border-radius: 5px;
2022-04-15 14:24:30 +00:00
2022-07-16 15:44:45 +00:00
> * {
transform: scale(0);
transform-origin: bottom left;
transition: transform var(--transition-duration), width var(--transition-duration);
}
2022-04-15 14:24:30 +00:00
&.non-empty {
display: block;
}
}
2022-07-16 09:52:39 +00:00
.right {
flex: 1;
display: flex;
gap: 1.5rem;
align-items: center;
overflow: hidden;
}
h1.name {
2022-07-16 15:44:45 +00:00
font-size: 4rem;
font-weight: var(--font-weight-bold);
2022-04-15 14:24:30 +00:00
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
2022-07-16 15:44:45 +00:00
margin-right: 1.5rem;
2022-04-15 14:24:30 +00:00
}
.heading-wrapper {
2022-07-16 09:52:39 +00:00
width: 100%;
2022-04-15 14:24:30 +00:00
overflow: hidden;
flex: 1;
}
.meta {
2022-07-16 09:52:39 +00:00
display: none;
2022-04-15 14:24:30 +00:00
font-size: .9rem;
line-height: 2;
font-weight: var(--font-weight-light);
a {
color: var(--color-text-primary);
&:hover {
color: var(--color-highlight);
}
}
2022-07-10 17:15:56 +00:00
> * + * {
margin-left: .2rem;
display: inline-block;
&::before {
content: '•';
margin-right: .2rem;
color: var(--color-text-secondary);
font-weight: unset;
}
}
2022-04-15 14:24:30 +00:00
}
@media (max-width: 768px) {
min-height: 0;
flex-direction: column;
.thumbnail-wrapper {
display: none;
}
h1 {
font-size: 1.38rem;
}
.meta {
display: none;
}
}
}
</style>