feat(Footnote): add component for footnote text

This commit is contained in:
Ilia Mashkov
2026-02-06 15:55:46 +03:00
parent a1080d3b34
commit 492c3573d0
3 changed files with 63 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
<script module>
import { defineMeta } from '@storybook/addon-svelte-csf';
import Footnote from './Footnote.svelte';
const { Story } = defineMeta({
title: 'Shared/Footnote',
tags: ['autodocs'],
parameters: {
docs: {
description: {
component: 'Styles footnote text',
},
story: { inline: false }, // Render stories in iframe for state isolation
},
},
});
</script>
<Story name="Default">
<Footnote>
Footnote
</Footnote>
</Story>
<Story name="With custom render">
<Footnote>
{#snippet render({ class: className })}
<span class={className}>Footnote</span>
{/snippet}
</Footnote>
</Story>

View File

@@ -0,0 +1,30 @@
<!--
Component: Footnote
Provides classes for styling footnotes
-->
<script lang="ts">
import { cn } from '$shared/shadcn/utils/shadcn-utils';
import type { Snippet } from 'svelte';
interface Props {
children?: Snippet;
class?: string;
/**
* Custom render function for full control
*/
render?: Snippet<[{ class: string }]>;
}
const { children, class: className, render }: Props = $props();
const baseClasses = 'font-mono text-[0.5625rem] sm:text-[0.625rem] uppercase tracking-[0.2em] text-gray-500 opacity-60';
const combinedClasses = cn(baseClasses, className);
</script>
{#if render}
{@render render({ class: combinedClasses })}
{:else if children}
<span class={combinedClasses}>
{@render children()}
</span>
{/if}

View File

@@ -4,8 +4,10 @@ export { default as ComboControl } from './ComboControl/ComboControl.svelte';
export { default as ComboControlV2 } from './ComboControlV2/ComboControlV2.svelte';
export { default as ContentEditable } from './ContentEditable/ContentEditable.svelte';
export { default as ExpandableWrapper } from './ExpandableWrapper/ExpandableWrapper.svelte';
export { default as Footnote } from './Footnote/Footnote.svelte';
export { default as IconButton } from './IconButton/IconButton.svelte';
export { default as Loader } from './Loader/Loader.svelte';
export { default as Logo } from './Logo/Logo.svelte';
export { default as SearchBar } from './SearchBar/SearchBar.svelte';
export { default as Section } from './Section/Section.svelte';
export { default as Skeleton } from './Skeleton/Skeleton.svelte';