feat(layout): add PageShell, ColumnsLayout, PageSection primitives
Introduces three new layout primitives (no consumers yet). Adds --page-pad-x/y/collapse CSS tokens to :root and .dark. Updates PageHeader to read padding from tokens. Removes ignored size="large" props from welcome and series pages. Fixes stray markdown in SidebarLayout.
This commit is contained in:
parent
797cf60c05
commit
127d2974c8
8 changed files with 152 additions and 6 deletions
98
app/components/ColumnsLayout.vue
Normal file
98
app/components/ColumnsLayout.vue
Normal file
|
|
@ -0,0 +1,98 @@
|
|||
<template>
|
||||
<div
|
||||
class="columns-layout"
|
||||
:class="[`columns-${cols}`, `divider-${divider}`, `collapse-${collapse}`]"
|
||||
>
|
||||
<template v-if="cols === 'events-sidebar'">
|
||||
<div class="col col-main">
|
||||
<slot />
|
||||
</div>
|
||||
<EventsMiniSidebar :events="upcomingEvents" />
|
||||
</template>
|
||||
<template v-else>
|
||||
<!-- cols="2": named slots only. Use <template #left> and <template #right>. -->
|
||||
<div class="col col-left">
|
||||
<slot name="left" />
|
||||
</div>
|
||||
<div class="col col-right">
|
||||
<slot name="right" />
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
const props = defineProps({
|
||||
cols: { type: String, default: '2' }, // "2" | "events-sidebar"
|
||||
divider: { type: String, default: 'dashed' }, // "dashed" | "none"
|
||||
collapse: { type: String, default: '1024' }, // "1024" | "768"
|
||||
limit: { type: Number, default: 3 },
|
||||
})
|
||||
|
||||
const upcomingEvents = ref([])
|
||||
if (props.cols === 'events-sidebar') {
|
||||
const { data } = await useFetch('/api/events', {
|
||||
query: { upcoming: true, limit: props.limit },
|
||||
default: () => [],
|
||||
})
|
||||
upcomingEvents.value = data.value || []
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.columns-layout {
|
||||
display: grid;
|
||||
align-items: stretch;
|
||||
}
|
||||
|
||||
/* cols="2" */
|
||||
.columns-2 {
|
||||
grid-template-columns: 1fr 1fr;
|
||||
}
|
||||
|
||||
/* cols="events-sidebar" */
|
||||
.columns-events-sidebar {
|
||||
grid-template-columns: 1fr 200px;
|
||||
}
|
||||
|
||||
/* Ensure grid children don't overflow */
|
||||
.col {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
/* Dashed divider: right border on the first column child */
|
||||
.divider-dashed .col:first-child,
|
||||
.divider-dashed .col-main {
|
||||
border-right: 1px dashed var(--border);
|
||||
}
|
||||
|
||||
/* Responsive collapse at 1024px (default) */
|
||||
.collapse-1024 {
|
||||
--col-collapse: 1024px;
|
||||
}
|
||||
|
||||
/* Responsive collapse at 768px */
|
||||
.collapse-768 {
|
||||
--col-collapse: 768px;
|
||||
}
|
||||
|
||||
@media (max-width: 1024px) {
|
||||
.collapse-1024 {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
.collapse-1024 .col:first-child,
|
||||
.collapse-1024 .col-main {
|
||||
border-right: none;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.collapse-768 {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
.collapse-768 .col:first-child,
|
||||
.collapse-768 .col-main {
|
||||
border-right: none;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -15,7 +15,7 @@ defineProps({
|
|||
|
||||
<style scoped>
|
||||
.page-header {
|
||||
padding: 24px 28px 16px;
|
||||
padding: var(--page-pad-y) var(--page-pad-x) 16px;
|
||||
border-bottom: 1px dashed var(--border);
|
||||
}
|
||||
.page-header h1 {
|
||||
|
|
|
|||
23
app/components/PageSection.vue
Normal file
23
app/components/PageSection.vue
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
<template>
|
||||
<div class="page-section" :class="`divider-${divider}`">
|
||||
<slot />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
defineProps({
|
||||
divider: { type: String, default: 'none' }, // "top" | "bottom" | "none"
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.page-section {
|
||||
padding: var(--page-pad-x) var(--page-pad-x);
|
||||
}
|
||||
.page-section.divider-top {
|
||||
border-top: 1px dashed var(--border);
|
||||
}
|
||||
.page-section.divider-bottom {
|
||||
border-bottom: 1px dashed var(--border);
|
||||
}
|
||||
</style>
|
||||
24
app/components/PageShell.vue
Normal file
24
app/components/PageShell.vue
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
<template>
|
||||
<component :is="as" class="page-shell">
|
||||
<PageHeader v-if="title" :title="title" :subtitle="subtitle" />
|
||||
<slot />
|
||||
</component>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
defineProps({
|
||||
title: { type: String, default: '' },
|
||||
subtitle: { type: String, default: '' },
|
||||
as: { type: String, default: 'div' },
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.page-shell {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-height: 0;
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -41,6 +41,3 @@ const { data: upcomingEvents } = await useFetch('/api/events', {
|
|||
}
|
||||
}
|
||||
</style>
|
||||
```
|
||||
|
||||
Now let me apply this to each page. Let me update all four in parallel:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue