import type { Meta, StoryObj } from "@storybook/nextjs-vite" import { expect } from "storybook/test" import { TextLink } from "." import { MaterialIcon } from "../Icons/MaterialIcon" import { Typography } from "../Typography" import { config } from "./variants" const meta: Meta = { title: "Core Components/TextLink", component: TextLink, argTypes: { theme: { control: "select", options: Object.keys(config.variants.theme), default: config.defaultVariants.theme, }, isInline: { control: "boolean", default: false, description: "Should be used when the link is placed inside a text block, removes the padding.", }, isDisabled: { control: "boolean", default: false, description: "Disables the link and makes it non-interactive.", }, }, } export default meta type Story = StoryObj export const Default: Story = { args: { href: "https://www.scandichotels.com/en", }, render: (args) => Default link, play: async ({ canvas }) => { const link = await canvas.findByRole("link") expect(link).toBeInTheDocument() }, } export const Inverted: Story = { args: { ...Default.args, theme: "Inverted", }, render: (args) => Inverted link, play: async ({ canvas }) => { const link = await canvas.findByRole("link") expect(link).toBeInTheDocument() }, } export const Disabled: Story = { args: { ...Default.args, isDisabled: true, }, render: (args) => Disabled link, play: async ({ canvas }) => { const link = await canvas.findByRole("link") expect(link).toBeInTheDocument() }, } export const WithIcon: Story = { args: { ...Default.args, }, render: (args) => ( Link with icon ), play: async ({ canvas }) => { const link = await canvas.findByRole("link") expect(link).toBeInTheDocument() }, } export const Small: Story = { args: { ...Default.args, typography: "Link/sm", }, render: (args) => Small link, play: async ({ canvas }) => { const link = await canvas.findByRole("link") expect(link).toBeInTheDocument() }, } export const SmallWithIcon: Story = { args: { ...Default.args, typography: "Link/sm", }, render: (args) => ( Small link with icon ), play: async ({ canvas }) => { const link = await canvas.findByRole("link") expect(link).toBeInTheDocument() }, } export const Inline: Story = { args: { ...Default.args, isInline: true, }, render: (args) => (

Lorem ipsum dolor sit amet, consectetur adipiscing elit.{" "} Inline link Curabitur vitae neque non ipsum efficitur hendrerit at ut nulla. Cras in tellus et ligula posuere ullamcorper. Praesent pulvinar rutrum metus ut gravida.

), play: async ({ canvas }) => { const link = await canvas.findByRole("link") expect(link).toBeInTheDocument() }, }