Files
imen_pishghaman/apps/web/app/components/ui/SectionHead.vue
T

55 lines
1.6 KiB
Vue

<script setup lang="ts">
import Lines from "./Lines.vue";
import Reveal from "./Reveal.vue";
withDefaults(
defineProps<{
tag: string;
/** title text; "\n" = line break. Use the #title slot for custom markup */
title?: string;
/** optional accented last line of the title */
highlight?: string;
desc?: string;
center?: boolean;
headingId?: string;
/** heading level; 1 for the main title of a page (one <h1> per page) */
level?: 1 | 2;
}>(),
{ center: false, level: 2 },
);
</script>
<template>
<div :class="center ? 'text-center' : ''">
<Reveal>
<div :class="`flex items-center gap-3 ${center ? 'justify-center' : ''}`">
<span class="font-mono text-sm text-accent">//</span>
<span class="font-mono text-xs tracking-[0.25em] text-muted">
{{ tag }}
</span>
<span class="h-px w-14 bg-line" />
</div>
</Reveal>
<Reveal :delay="0.08">
<component
:is="`h${level}`"
:id="headingId"
class="mt-3.5 sm:mt-5 text-2xl sm:text-3xl md:text-5xl font-black leading-tight sm:leading-[1.25] md:leading-[1.2]"
>
<slot name="title">
<Lines v-if="title" :text="title" />
<template v-if="highlight">
<br />
<span class="text-accent">{{ highlight }}</span>
</template>
</slot>
</component>
</Reveal>
<Reveal v-if="desc" :delay="0.16">
<p :class="`mt-3 sm:mt-5 max-w-xl text-xs sm:text-base leading-6 sm:leading-8 text-muted ${center ? 'mx-auto' : ''}`">
{{ desc }}
</p>
</Reveal>
</div>
</template>