slidev-theme-narduin/layouts/title-image.vue

44 lines
729 B
Vue
Raw Normal View History

2024-12-13 14:30:22 +01:00
<script setup lang="ts">
import { imageSrc } from '../utils/imageHelper'
const props = defineProps({
image: {
type: String,
required: true
2024-12-19 14:07:20 +01:00
},
ratio: {
type: String,
default: '3fr 2fr'
},
imageAlign: {
type: String,
default: 'center'
2024-12-13 14:30:22 +01:00
}
})
const image = imageSrc(props.image)
</script>
<template>
<div class="slidev-layout h-full title">
2024-12-17 22:50:34 +01:00
<div class="grid h-full gap-4">
2024-12-19 14:07:20 +01:00
<div>
2024-12-13 14:30:22 +01:00
<slot />
</div>
<div class="image"></div>
</div>
</div>
</template>
<style scoped>
2024-12-17 22:50:34 +01:00
.grid {
2024-12-19 14:07:20 +01:00
grid-template-columns: v-bind(ratio);
2024-12-17 22:50:34 +01:00
}
2024-12-13 14:30:22 +01:00
.image {
block-size: 100%;
background-image: v-bind(image);
background-size: cover;
2024-12-19 14:07:20 +01:00
background-position: v-bind(imageAlign);
2024-12-13 14:30:22 +01:00
}
</style>