Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import type { ComponentProps } from "svelte";
import AppNav from "./AppNav.svelte";

export default {
title: "Fragments/AppNav",
component: AppNav,
tags: ["autodocs"],
render: (args: {
Component: AppNav;
props: ComponentProps<typeof AppNav>;
}) => ({
Component: AppNav,
props: args,
}),
};

export const Basic = {
args: {
title: "Settings",
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<script lang="ts">
import * as Button from "$lib/ui/Button";
import { cn } from "$lib/utils";
import { ArrowLeft01Icon, Settings02Icon } from "@hugeicons/core-free-icons";
import type { HTMLAttributes } from "svelte/elements";
interface IHeroProps extends HTMLAttributes<HTMLElement> {
title?: string;
titleClasses?: string;
}
const { title, titleClasses, ...restProps }: IHeroProps = $props();
const baseClasses = "w-full relative flex justify-center h-14 items-center";
</script>

<nav {...restProps} class={cn(baseClasses, restProps.class)}>
<Button.Icon
icon={ArrowLeft01Icon}
iconSize="md"
iconColor={"black"}
class="absolute left-2"
onclick={() => window.history.back()}
/>
<h4 class={cn(titleClasses)}>
{title}
</h4>
</nav>

<!--
@component
@name AppNav
@description A component that displays the title of the current page and a back button.
@props
- title: string - The main title to display.
- titleClasses: string - Additional classes to apply to the title element.
@usage
```svelte
<AppNav title="My Title" />
-->