diff --git a/app/components/landing/LandingTabs.vue b/app/components/landing/LandingTabs.vue index 02de78a..d5cc38a 100644 --- a/app/components/landing/LandingTabs.vue +++ b/app/components/landing/LandingTabs.vue @@ -5,12 +5,36 @@ interface Tab { description?: string } -const props = defineProps<{ +const props = withDefaults(defineProps<{ items: Tab[] reverse?: boolean | string -}>() + /** + * Where the headline, title and description go: `side` stacks them above the + * tab list in its column; `center` and `left` put them above both columns, + * centered or left-aligned. + */ + header?: 'side' | 'center' | 'left' +}>(), { + reverse: false, + header: 'side', +}) const reversed = computed(() => props.reverse === true || props.reverse === 'true' || props.reverse === '') +const stacked = computed(() => props.header !== 'side') + +/** + * One grid for every layout: the header, tab list and panel are its items. On + * the side layout, the panel spans both rows of the other column, and the + * shorter column sits at the bottom; stacked, the header spans both columns + * and the tab list and panel are top-aligned below it. + */ +const tabColumn = computed(() => reversed.value ? 'lg:col-start-2' : 'lg:col-start-1') +const panelColumn = computed(() => reversed.value ? 'lg:col-start-1' : 'lg:col-start-2') +const headerClass = computed(() => { + if (!stacked.value) return [tabColumn.value, 'lg:self-end'] + return props.header === 'center' ? 'lg:col-span-2 mx-auto max-w-2xl text-center' : 'lg:col-span-2 max-w-2xl' +}) +const panelClass = computed(() => [panelColumn.value, stacked.value ? 'lg:row-start-2 lg:self-start' : 'lg:row-start-1 lg:row-span-2 lg:self-end']) const activeIndex = ref(0) @@ -54,83 +78,89 @@ function onKeydown(event: KeyboardEvent) { container: 'max-w-6xl py-16 sm:py-16 lg:py-16', }" > -
+
-
-

- // // -

-

- -

-

- -

-
+

+ // // +

+

+ +

+

+ +

+
-
+ -
+ {{ item.description }} +

+
+
-
+
diff --git a/playground/content/2.writing/4.landing-page.md b/playground/content/2.writing/4.landing-page.md index 04f7240..9b5aa48 100644 --- a/playground/content/2.writing/4.landing-page.md +++ b/playground/content/2.writing/4.landing-page.md @@ -148,6 +148,7 @@ git push | --- | --- | --- | | `items` | `{ icon?, title, description? }[]` (required) | One entry per tab. | | `reverse` | `boolean` | Flips the column order. | +| `header` | `'side' \| 'center' \| 'left'` | Where the `headline`, `title` and `description` go. `side` (default) stacks them above the tab list in its column. `center` and `left` put them above both columns, centered or left-aligned, and top-align the tab list and panel; use one when panels are shorter than the header and tab list. | Slots: `headline`, `title`, `description`, `code-0` … `code-n`.