Merged in fix/3697-prettier-configs (pull request #3396)
fix(SW-3691): Setup one prettier config for whole repo * Setup prettierrc in root and remove other configs Approved-by: Joakim Jäderberg Approved-by: Linus Flood
This commit is contained in:
@@ -1,31 +1,31 @@
|
||||
import type { Meta, StoryObj } from '@storybook/nextjs-vite'
|
||||
import type { Meta, StoryObj } from "@storybook/nextjs-vite"
|
||||
|
||||
import { expect } from 'storybook/test'
|
||||
import { expect } from "storybook/test"
|
||||
|
||||
import { TextLink } from '.'
|
||||
import { MaterialIcon } from '../Icons/MaterialIcon'
|
||||
import { Typography } from '../Typography'
|
||||
import { config } from './variants'
|
||||
import { TextLink } from "."
|
||||
import { MaterialIcon } from "../Icons/MaterialIcon"
|
||||
import { Typography } from "../Typography"
|
||||
import { config } from "./variants"
|
||||
|
||||
const meta: Meta<typeof TextLink> = {
|
||||
title: 'Core Components/TextLink',
|
||||
title: "Core Components/TextLink",
|
||||
component: TextLink,
|
||||
argTypes: {
|
||||
theme: {
|
||||
control: 'select',
|
||||
control: "select",
|
||||
options: Object.keys(config.variants.theme),
|
||||
default: config.defaultVariants.theme,
|
||||
},
|
||||
isInline: {
|
||||
control: 'boolean',
|
||||
control: "boolean",
|
||||
default: false,
|
||||
description:
|
||||
'Should be used when the link is placed inside a text block, removes the padding.',
|
||||
"Should be used when the link is placed inside a text block, removes the padding.",
|
||||
},
|
||||
isDisabled: {
|
||||
control: 'boolean',
|
||||
control: "boolean",
|
||||
default: false,
|
||||
description: 'Disables the link and makes it non-interactive.',
|
||||
description: "Disables the link and makes it non-interactive.",
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -36,12 +36,12 @@ type Story = StoryObj<typeof TextLink>
|
||||
|
||||
export const Default: Story = {
|
||||
args: {
|
||||
href: 'https://www.scandichotels.com/en',
|
||||
href: "https://www.scandichotels.com/en",
|
||||
},
|
||||
render: (args) => <TextLink {...args}>Default link</TextLink>,
|
||||
play: async ({ canvasElement }) => {
|
||||
const link = canvasElement.querySelector('a')
|
||||
if (!link) throw new Error('Link not found')
|
||||
const link = canvasElement.querySelector("a")
|
||||
if (!link) throw new Error("Link not found")
|
||||
expect(link).toBeInTheDocument()
|
||||
},
|
||||
}
|
||||
@@ -49,12 +49,12 @@ export const Default: Story = {
|
||||
export const Inverted: Story = {
|
||||
args: {
|
||||
...Default.args,
|
||||
theme: 'Inverted',
|
||||
theme: "Inverted",
|
||||
},
|
||||
render: (args) => <TextLink {...args}>Inverted link</TextLink>,
|
||||
play: async ({ canvasElement }) => {
|
||||
const link = canvasElement.querySelector('a')
|
||||
if (!link) throw new Error('Link not found')
|
||||
const link = canvasElement.querySelector("a")
|
||||
if (!link) throw new Error("Link not found")
|
||||
expect(link).toBeInTheDocument()
|
||||
},
|
||||
}
|
||||
@@ -66,8 +66,8 @@ export const Disabled: Story = {
|
||||
},
|
||||
render: (args) => <TextLink {...args}>Disabled link</TextLink>,
|
||||
play: async ({ canvasElement }) => {
|
||||
const link = canvasElement.querySelector('a')
|
||||
if (!link) throw new Error('Link not found')
|
||||
const link = canvasElement.querySelector("a")
|
||||
if (!link) throw new Error("Link not found")
|
||||
expect(link).toBeInTheDocument()
|
||||
},
|
||||
}
|
||||
@@ -83,8 +83,8 @@ export const WithIcon: Story = {
|
||||
</TextLink>
|
||||
),
|
||||
play: async ({ canvasElement }) => {
|
||||
const link = canvasElement.querySelector('a')
|
||||
if (!link) throw new Error('Link not found')
|
||||
const link = canvasElement.querySelector("a")
|
||||
if (!link) throw new Error("Link not found")
|
||||
expect(link).toBeInTheDocument()
|
||||
},
|
||||
}
|
||||
@@ -92,12 +92,12 @@ export const WithIcon: Story = {
|
||||
export const Small: Story = {
|
||||
args: {
|
||||
...Default.args,
|
||||
typography: 'Link/sm',
|
||||
typography: "Link/sm",
|
||||
},
|
||||
render: (args) => <TextLink {...args}>Small link</TextLink>,
|
||||
play: async ({ canvasElement }) => {
|
||||
const link = canvasElement.querySelector('a')
|
||||
if (!link) throw new Error('Link not found')
|
||||
const link = canvasElement.querySelector("a")
|
||||
if (!link) throw new Error("Link not found")
|
||||
expect(link).toBeInTheDocument()
|
||||
},
|
||||
}
|
||||
@@ -105,7 +105,7 @@ export const Small: Story = {
|
||||
export const SmallWithIcon: Story = {
|
||||
args: {
|
||||
...Default.args,
|
||||
typography: 'Link/sm',
|
||||
typography: "Link/sm",
|
||||
},
|
||||
render: (args) => (
|
||||
<TextLink {...args}>
|
||||
@@ -114,8 +114,8 @@ export const SmallWithIcon: Story = {
|
||||
</TextLink>
|
||||
),
|
||||
play: async ({ canvasElement }) => {
|
||||
const link = canvasElement.querySelector('a')
|
||||
if (!link) throw new Error('Link not found')
|
||||
const link = canvasElement.querySelector("a")
|
||||
if (!link) throw new Error("Link not found")
|
||||
expect(link).toBeInTheDocument()
|
||||
},
|
||||
}
|
||||
@@ -128,7 +128,7 @@ export const Inline: Story = {
|
||||
render: (args) => (
|
||||
<Typography variant="Body/Paragraph/mdRegular">
|
||||
<p>
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit.{' '}
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit.{" "}
|
||||
<TextLink {...args}>Inline link</TextLink> Curabitur vitae neque non
|
||||
ipsum efficitur hendrerit at ut nulla. Cras in tellus et ligula posuere
|
||||
ullamcorper. Praesent pulvinar rutrum metus ut gravida.
|
||||
@@ -136,8 +136,8 @@ export const Inline: Story = {
|
||||
</Typography>
|
||||
),
|
||||
play: async ({ canvasElement }) => {
|
||||
const link = canvasElement.querySelector('a')
|
||||
if (!link) throw new Error('Link not found')
|
||||
const link = canvasElement.querySelector("a")
|
||||
if (!link) throw new Error("Link not found")
|
||||
expect(link).toBeInTheDocument()
|
||||
},
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
'use client'
|
||||
"use client"
|
||||
|
||||
import { cx } from 'class-variance-authority'
|
||||
import NextLink from 'next/link'
|
||||
import { TextLinkProps } from './types'
|
||||
import { variants } from './variants'
|
||||
import { cx } from "class-variance-authority"
|
||||
import NextLink from "next/link"
|
||||
import { TextLinkProps } from "./types"
|
||||
import { variants } from "./variants"
|
||||
|
||||
import styles from './textLink.module.css'
|
||||
import { useIntl } from 'react-intl'
|
||||
import styles from "./textLink.module.css"
|
||||
import { useIntl } from "react-intl"
|
||||
|
||||
export function TextLink({
|
||||
theme,
|
||||
@@ -34,12 +34,12 @@ export function TextLink({
|
||||
[styles.inline]: isInline,
|
||||
})}
|
||||
title={
|
||||
props.target === '_blank'
|
||||
props.target === "_blank"
|
||||
? intl.formatMessage({
|
||||
id: 'common.linkOpenInNewTab',
|
||||
defaultMessage: 'Opens in a new tab/window',
|
||||
id: "common.linkOpenInNewTab",
|
||||
defaultMessage: "Opens in a new tab/window",
|
||||
})
|
||||
: ''
|
||||
: ""
|
||||
}
|
||||
/>
|
||||
)
|
||||
|
||||
@@ -1 +1 @@
|
||||
export { TextLink } from './TextLink'
|
||||
export { TextLink } from "./TextLink"
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
import type { VariantProps } from 'class-variance-authority'
|
||||
import NextLink from 'next/link'
|
||||
import type { ComponentProps } from 'react'
|
||||
import type { VariantProps } from "class-variance-authority"
|
||||
import NextLink from "next/link"
|
||||
import type { ComponentProps } from "react"
|
||||
|
||||
import type { variants } from './variants'
|
||||
import type { variants } from "./variants"
|
||||
|
||||
export interface TextLinkProps
|
||||
extends ComponentProps<typeof NextLink>,
|
||||
VariantProps<typeof variants> {
|
||||
extends ComponentProps<typeof NextLink>, VariantProps<typeof variants> {
|
||||
isDisabled?: boolean
|
||||
isInline?: boolean
|
||||
}
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
import { cva } from 'class-variance-authority'
|
||||
import { cva } from "class-variance-authority"
|
||||
|
||||
import {
|
||||
config as typographyConfig,
|
||||
withTypography,
|
||||
} from '../Typography/variants'
|
||||
} from "../Typography/variants"
|
||||
|
||||
import { deepmerge } from 'deepmerge-ts'
|
||||
import styles from './textLink.module.css'
|
||||
import { deepmerge } from "deepmerge-ts"
|
||||
import styles from "./textLink.module.css"
|
||||
|
||||
export const config = {
|
||||
variants: {
|
||||
theme: {
|
||||
Primary: styles['theme-primary'],
|
||||
Inverted: styles['theme-inverted'],
|
||||
InteractiveDefault: styles['theme-interactive-default'],
|
||||
Primary: styles["theme-primary"],
|
||||
Inverted: styles["theme-inverted"],
|
||||
InteractiveDefault: styles["theme-interactive-default"],
|
||||
},
|
||||
},
|
||||
defaultVariants: {
|
||||
theme: 'Primary',
|
||||
theme: "Primary",
|
||||
},
|
||||
} as const
|
||||
|
||||
@@ -28,7 +28,7 @@ const textLinkConfig = {
|
||||
},
|
||||
defaultVariants: {
|
||||
...config.defaultVariants,
|
||||
typography: 'Link/md',
|
||||
typography: "Link/md",
|
||||
},
|
||||
} as const
|
||||
|
||||
|
||||
Reference in New Issue
Block a user