import type { Meta, StoryObj } from '@storybook/react-vite' import { Link } from './Link' import { Card } from './Card' import { Chip } from './Chip' const meta = { title: 'Navigation/Link', component: Link, args: { href: '#', variant: 'text', external: false, children: 'a link' }, argTypes: { variant: { control: 'inline-radio', options: ['text', 'quiet', 'underlined', 'plain'] }, }, } satisfies Meta export default meta type Story = StoryObj /** Inside written text: the theme's link colour, always underlined. Hover dims it. */ export const Text: Story = { render: (args) => (

A sentence can hold in the middle of it, and the words around it read on.

), } /** A title, or a small time, that is also a link: it keeps its text's colour and size, and underlines on hover. */ export const Quiet: Story = { args: { variant: 'quiet', children: 'Item one' }, render: (args) => (

2:14 PM

), } /** Beside a note, a short way to open the thing somewhere else: the note's colour, always underlined. Hover brightens it. */ export const Underlined: Story = { args: { variant: 'underlined', external: true, children: 'Open it there ↗' }, render: (args) => (

This can’t be shown here.

), } /** No look of its own: what it wraps draws itself — a box, a row. */ export const Plain: Story = { args: { variant: 'plain', children: undefined }, render: (args) => (
Item one
), } /** Another site or app: a new tab, and `noopener noreferrer`. It looks the same; the difference is where it opens. */ export const External: Story = { args: { external: true, children: 'a page elsewhere' }, render: (args) => (

Read in a new tab.

), } const ROWS = [ { key: 'A-1', title: 'Item one', group: 'Group', time: '2h' }, { key: 'A-2', title: 'Item two', group: 'Group', time: '1d' }, { key: 'A-3', title: 'Item three', time: '3d' }, ] /** * A row that is one link: click anywhere on it, or Tab to it and the ring goes * round the whole row. The chip is a second link, and opens something else. */ export const Cover: Story = { parameters: { controls: { disable: true } }, render: () => (
{ROWS.map((row) => (
{row.key} {row.title} {row.group && } {row.time}
))}
), } /** The same in a table: the row is `relative`, the title a `quiet` link that covers it. */ export const CoverInTable: Story = { parameters: { controls: { disable: true } }, render: () => ( {ROWS.map((row) => ( ))}
{row.key} {row.title} {row.time}
), } /** The four looks, each where it belongs. */ export const AllVariants: Story = { parameters: { controls: { disable: true } }, render: () => (

text — a sentence with a link in it.

quiet — Item one

underlined — This can’t be shown here.{' '} Open it there ↗

plain —
Item one
), } /** `truncate`: a title that is a link, on one line. Its size and colour come from the box around it. */ export const Truncate: Story = { parameters: { controls: { disable: true } }, render: () => (
Assignee avatar and full name is missing in the files panel
), }