slidev-theme-narduin/layouts/auto-grid.vue

34 lines
580 B
Vue
Raw Normal View History

2024-12-16 23:40:18 +01:00
<script setup lang="ts">
2024-12-17 12:59:36 +01:00
defineProps<{
2024-12-16 23:40:18 +01:00
columns?: number
2024-12-17 12:59:36 +01:00
rows?: string
2024-12-16 23:40:18 +01:00
}>()
</script>
2024-12-16 21:25:03 +01:00
<template>
<div class="slidev-layout">
2024-12-17 12:59:36 +01:00
<div>
<slot />
<div class="auto-grid">
<slot name="content" />
</div>
<slot name="after" />
2024-12-16 21:25:03 +01:00
</div>
</div>
</template>
<style scoped>
.auto-grid {
2024-12-17 12:59:36 +01:00
--columns: v-bind(columns);
--rows: v-bind(rows);
2024-12-16 21:25:03 +01:00
display: grid;
2024-12-17 12:59:36 +01:00
grid-template-columns: repeat(var(--columns, 2), 1fr);
grid-auto-rows: var(--rows, auto);
2024-12-16 21:25:03 +01:00
gap: var(--space-xs);
}
2024-12-16 23:40:18 +01:00
.auto-grid > * {
inline-size: 100%;
block-size: 100%;
}
2024-12-16 21:25:03 +01:00
</style>