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

163 lines
2.8 KiB
Vue
Raw Normal View History

2022-04-15 14:24:30 +00:00
<template>
<header class="screen-header" :class="[ layout, disabled ? 'disabled' : '' ]">
2022-07-30 15:08:20 +00:00
<aside class="thumbnail-wrapper">
2022-04-15 14:24:30 +00:00
<slot name="thumbnail"></slot>
2022-07-30 15:08:20 +00:00
</aside>
2022-04-15 14:24:30 +00:00
2022-07-30 15:08:20 +00:00
<main>
2022-07-16 09:52:39 +00:00
<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-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>
const props = withDefaults(defineProps<{
layout?: ScreenHeaderLayout,
disabled?: boolean,
}>(), {
layout: 'expanded',
disabled: false
})
2022-04-15 14:24:30 +00:00
</script>
<style lang="scss" scoped>
2022-07-10 17:15:56 +00:00
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;
flex-shrink: 0;
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
&.disabled {
opacity: .5;
cursor: not-allowed;
*, *::before, *::after {
pointer-events: none;
}
}
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;
}
2022-07-30 15:08:20 +00:00
main {
2022-07-16 09:52:39 +00:00
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-07-17 08:58:05 +00:00
display: block;
2022-07-16 15:44:45 +00:00
width: 0;
transition: width var(--transition-duration);
2022-07-16 09:52:39 +00:00
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-07-17 08:58:05 +00:00
&:empty {
display: none;
2022-04-15 14:24:30 +00:00
}
}
2022-07-30 15:08:20 +00:00
main {
2022-07-16 09:52:39 +00:00
flex: 1;
display: flex;
gap: 1.5rem;
align-items: center;
overflow: hidden;
}
h1.name {
font-size: clamp(1.8rem, 3vw, 4rem);
2022-07-16 15:44:45 +00:00
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
2022-10-27 17:06:49 +00:00
> :slotted(* + *) {
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;
.thumbnail-wrapper {
display: none;
}
2022-07-29 12:12:55 +00:00
h1.name {
font-weight: var(--font-weight-thin);
2022-04-15 14:24:30 +00:00
}
.meta {
display: none;
}
}
}
</style>