slidev-theme-narduin/layouts/auto-grid.vue
2024-12-17 22:50:34 +01:00

38 lines
625 B
Vue

<script setup lang="ts">
defineProps<{
columns?: number
rows?: string
}>()
</script>
<template>
<div class="slidev-layout">
<div>
<slot />
<div class="auto-grid">
<slot name="content" />
</div>
<slot name="after" />
</div>
</div>
</template>
<style scoped>
.auto-grid {
--columns: v-bind(columns);
--rows: v-bind(rows);
display: grid;
grid-template-columns: repeat(var(--columns, 2), 1fr);
grid-auto-rows: var(--rows, auto);
gap: var(--space-xs);
& > * {
inline-size: 100%;
block-size: 100%;
}
& > :deep(img) {
block-size: auto;
}
}
</style>