import type { Meta, StoryObj } from '@storybook/web-components-vite'; import { html } from 'lit'; import './usa-documentation-template.js'; const meta: Meta = { title: 'Templates/Documentation', component: 'usa-documentation-template', tags: ['autodocs'], parameters: { layout: 'fullscreen', docs: { description: { component: ` The documentation template provides a layout with side navigation for documentation pages. ## Features - Side navigation (left or right) - Responsive design (sidenav moves below content on mobile) - Breadcrumb slot - Prose styling for content - Government banner and identifier ## USWDS Reference https://designsystem.digital.gov/templates/documentation-page/ `, }, }, }, argTypes: { sidenavPosition: { control: 'select', options: ['left', 'right'], description: 'Side navigation position', }, contentWidth: { control: 'select', options: ['narrow', 'wide'], description: 'Content column width', }, showBanner: { control: 'boolean', description: 'Show government banner', }, showIdentifier: { control: 'boolean', description: 'Show identifier', }, }, }; export default meta; type Story = StoryObj; const sampleNavItems = [ { label: 'Overview', href: '#overview', current: true }, { label: 'Getting Started', href: '#getting-started', subnav: [ { label: 'Installation', href: '#installation' }, { label: 'Configuration', href: '#configuration' }, ], }, { label: 'Components', href: '#components' }, { label: 'Patterns', href: '#patterns' }, { label: 'Templates', href: '#templates' }, ]; export const Default: Story = { args: { sidenavPosition: 'left', contentWidth: 'wide', showBanner: true, showIdentifier: true, }, render: (args) => html`

Documentation Overview

Welcome to our documentation. This template provides a clean layout for technical documentation with side navigation.

Getting Started

To get started, follow the installation instructions below. Our documentation is organized into sections that cover all aspects of the system.

Installation

Install the package using npm:

npm install @uswds/web-components

Configuration

Configure your project by adding the following to your configuration file. Make sure to include all required dependencies.

Components

Our component library includes a variety of reusable UI elements that follow USWDS design patterns.

Patterns

Patterns combine multiple components to solve common design problems such as form layouts and navigation structures.

`, }; export const WithBreadcrumb: Story = { args: { showBanner: true, showIdentifier: true, }, render: (args) => html`

Getting Started Guide

This guide will help you get up and running with our system.

Follow the steps below to complete the initial setup. If you encounter any issues, please refer to our troubleshooting section.

`, }; export const SidenavRight: Story = { args: { sidenavPosition: 'right', showBanner: true, showIdentifier: true, }, render: (args) => html`

Documentation with Right Sidenav

This layout places the side navigation on the right side of the content.

This can be useful when the primary focus should be on the content, with navigation available as a secondary element.

`, }; export const NarrowContent: Story = { args: { contentWidth: 'narrow', showBanner: true, showIdentifier: true, }, render: (args) => html`

Narrow Content Layout

This layout uses a narrower content column for improved readability.

Long-form content often benefits from narrower line lengths, making it easier for users to read and follow along.

`, }; export const CustomSidenav: Story = { args: { showBanner: true, showIdentifier: true, }, render: (args) => html`

Custom Side Navigation

This example shows how to use a custom sidenav slot for complete control over the navigation structure.

`, }; export const APIDocumentation: Story = { args: { showBanner: true, showIdentifier: true, }, render: (args) => { const apiNavItems = [ { label: 'Introduction', href: '#intro', current: true }, { label: 'Authentication', href: '#auth', subnav: [ { label: 'API Keys', href: '#api-keys' }, { label: 'OAuth 2.0', href: '#oauth' }, ], }, { label: 'Endpoints', href: '#endpoints', subnav: [ { label: 'Users', href: '#users' }, { label: 'Resources', href: '#resources' }, ], }, { label: 'Error Handling', href: '#errors' }, { label: 'Rate Limits', href: '#rate-limits' }, ]; return html`

API Reference

Complete reference documentation for our REST API.

Authentication

All API requests require authentication. Choose from the following methods:

API Keys

Include your API key in the request header:

Authorization: Bearer YOUR_API_KEY

OAuth 2.0

For user-specific operations, use OAuth 2.0 authorization flow.

API Endpoints

Below you'll find detailed documentation for each API endpoint.

Users Endpoint

GET /api/v1/users - List all users

POST /api/v1/users - Create a new user

Resources Endpoint

GET /api/v1/resources - List all resources

Error Handling

The API uses standard HTTP response codes to indicate success or failure.

Rate Limits

API requests are limited to 1000 requests per hour per API key.

`; }, }; export const MinimalDocumentation: Story = { args: { showBanner: false, showIdentifier: false, }, render: (args) => html`

Minimal Documentation Page

A documentation page without government banner, identifier, or sidenav.

This is useful for internal documentation or simple help pages where the full template structure is not needed.

`, };