feat(Section): add a snippet prop for description
This commit is contained in:
@@ -25,6 +25,10 @@ interface Props extends Omit<HTMLAttributes<HTMLElement>, 'title'> {
|
||||
* Snippet for a title icon
|
||||
*/
|
||||
icon?: Snippet<[{ className?: string }]>;
|
||||
/**
|
||||
* Snippet for a title description
|
||||
*/
|
||||
description?: Snippet<[{ className?: string }]>;
|
||||
/**
|
||||
* Index of the section
|
||||
*/
|
||||
@@ -44,7 +48,7 @@ interface Props extends Omit<HTMLAttributes<HTMLElement>, 'title'> {
|
||||
children?: Snippet;
|
||||
}
|
||||
|
||||
const { class: className, title, icon, index = 0, onTitleStatusChange, children }: Props = $props();
|
||||
const { class: className, title, icon, description, index = 0, onTitleStatusChange, children }: Props = $props();
|
||||
|
||||
let titleContainer = $state<HTMLElement>();
|
||||
const flyParams: FlyParams = { y: 0, x: -50, duration: 300, easing: cubicOut, opacity: 0.2 };
|
||||
@@ -92,7 +96,9 @@ $effect(() => {
|
||||
{@render icon({ className: 'size-4 stroke-gray-900 stroke-1' })}
|
||||
<div class="w-px h-3 bg-gray-400/50"></div>
|
||||
{/if}
|
||||
{#if typeof index === 'number'}
|
||||
{#if description}
|
||||
{@render description({ className: 'font-mono text-[10px] uppercase tracking-[0.2em] text-gray-600' })}
|
||||
{:else if typeof index === 'number'}
|
||||
<span class="font-mono text-[10px] uppercase tracking-[0.2em] text-gray-600">
|
||||
Component_{String(index).padStart(3, '0')}
|
||||
</span>
|
||||
|
||||
Reference in New Issue
Block a user