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:
+50
-50
@@ -1,91 +1,91 @@
|
||||
import type { Meta, StoryObj } from '@storybook/nextjs-vite'
|
||||
import type { Meta, StoryObj } from "@storybook/nextjs-vite"
|
||||
|
||||
import { Lang } from '@scandic-hotels/common/constants/language'
|
||||
import { VideoWithCard } from '.'
|
||||
import { config } from './variants'
|
||||
import { Lang } from "@scandic-hotels/common/constants/language"
|
||||
import { VideoWithCard } from "."
|
||||
import { config } from "./variants"
|
||||
|
||||
const meta: Meta<typeof VideoWithCard> = {
|
||||
title: 'Core Components/Video/VideoWithCard',
|
||||
title: "Core Components/Video/VideoWithCard",
|
||||
component: VideoWithCard,
|
||||
parameters: {
|
||||
docs: {
|
||||
description: {
|
||||
component:
|
||||
'A component to display a VideoPlayer and content inside a card connected to the video. The size and gaps are determined by the parent container.',
|
||||
"A component to display a VideoPlayer and content inside a card connected to the video. The size and gaps are determined by the parent container.",
|
||||
},
|
||||
},
|
||||
},
|
||||
argTypes: {
|
||||
variant: {
|
||||
control: 'select',
|
||||
control: "select",
|
||||
options: Object.keys(config.variants.variant),
|
||||
table: {
|
||||
defaultValue: {
|
||||
summary: config.defaultVariants.variant,
|
||||
},
|
||||
type: {
|
||||
summary: Object.keys(config.variants.variant).join(' | '),
|
||||
summary: Object.keys(config.variants.variant).join(" | "),
|
||||
},
|
||||
},
|
||||
description:
|
||||
'The variant of the card, which determines its style of the text and what content is shown.',
|
||||
"The variant of the card, which determines its style of the text and what content is shown.",
|
||||
},
|
||||
style: {
|
||||
control: 'select',
|
||||
control: "select",
|
||||
options: Object.keys(config.variants.style),
|
||||
table: {
|
||||
defaultValue: {
|
||||
summary: config.defaultVariants.style,
|
||||
},
|
||||
type: {
|
||||
summary: Object.keys(config.variants.style).join(' | '),
|
||||
summary: Object.keys(config.variants.style).join(" | "),
|
||||
},
|
||||
},
|
||||
description:
|
||||
'This decides the background color and text color of the card.',
|
||||
"This decides the background color and text color of the card.",
|
||||
},
|
||||
heading: {
|
||||
table: {
|
||||
type: { summary: 'string' },
|
||||
type: { summary: "string" },
|
||||
},
|
||||
description: 'The heading text. Only applicable for the text variant.',
|
||||
description: "The heading text. Only applicable for the text variant.",
|
||||
},
|
||||
text: {
|
||||
table: {
|
||||
type: { summary: 'string' },
|
||||
type: { summary: "string" },
|
||||
},
|
||||
description: 'The body text. Only applicable for the text variant.',
|
||||
description: "The body text. Only applicable for the text variant.",
|
||||
},
|
||||
quote: {
|
||||
table: {
|
||||
type: { summary: 'string' },
|
||||
type: { summary: "string" },
|
||||
},
|
||||
description: 'The quote text. Only applicable for the quote variant.',
|
||||
description: "The quote text. Only applicable for the quote variant.",
|
||||
},
|
||||
author: {
|
||||
table: {
|
||||
type: { summary: 'string' },
|
||||
type: { summary: "string" },
|
||||
},
|
||||
description:
|
||||
'The author of the quote. Only applicable for the quote variant.',
|
||||
"The author of the quote. Only applicable for the quote variant.",
|
||||
},
|
||||
authorDescription: {
|
||||
table: {
|
||||
type: { summary: 'string' },
|
||||
type: { summary: "string" },
|
||||
},
|
||||
description:
|
||||
'The description of the author. Only applicable for the quote variant.',
|
||||
"The description of the author. Only applicable for the quote variant.",
|
||||
},
|
||||
video: {
|
||||
control: false,
|
||||
table: {
|
||||
type: {
|
||||
summary:
|
||||
'{ sources: { src: string; type: string }[]; poster?: { src: string; dimensions?: { width: number; height: number } }; captions?: Caption[]; focalPoint?: FocalPoint}',
|
||||
"{ sources: { src: string; type: string }[]; poster?: { src: string; dimensions?: { width: number; height: number } }; captions?: Caption[]; focalPoint?: FocalPoint}",
|
||||
},
|
||||
},
|
||||
description:
|
||||
'The video props including source URL, captions and focal point. Please note that not all props from the VideoPlayer component are supported in this wrapper component.',
|
||||
"The video props including source URL, captions and focal point. Please note that not all props from the VideoPlayer component are supported in this wrapper component.",
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -97,25 +97,25 @@ type Story = StoryObj<typeof VideoWithCard>
|
||||
const videoProps = {
|
||||
sources: [
|
||||
{
|
||||
src: 'https://eu-assets.contentstack.com/v3/assets/bltfd73aa2de3a5c4e3/bltc3aa53ac9bf6798c/693ad4b65b0889d6348893f3/Test_video.mp4',
|
||||
type: 'video/mp4',
|
||||
src: "https://eu-assets.contentstack.com/v3/assets/bltfd73aa2de3a5c4e3/bltc3aa53ac9bf6798c/693ad4b65b0889d6348893f3/Test_video.mp4",
|
||||
type: "video/mp4",
|
||||
},
|
||||
{
|
||||
src: 'https://eu-assets.contentstack.com/v3/assets/bltfd73aa2de3a5c4e3/blt029be07ddd444eea/693c251c09e17b33c93c1dd6/hero-banner-1920-vp9.webm',
|
||||
type: 'video/webm',
|
||||
src: "https://eu-assets.contentstack.com/v3/assets/bltfd73aa2de3a5c4e3/blt029be07ddd444eea/693c251c09e17b33c93c1dd6/hero-banner-1920-vp9.webm",
|
||||
type: "video/webm",
|
||||
},
|
||||
],
|
||||
poster: {
|
||||
src: 'https://imagevault.scandichotels.com/publishedmedia/dtpv2wgm6jhix2pqpp88/Scandic_Downtown_Camper_restaurang_bar_The_Nest_lounge_eld.jpg',
|
||||
src: "https://imagevault.scandichotels.com/publishedmedia/dtpv2wgm6jhix2pqpp88/Scandic_Downtown_Camper_restaurang_bar_The_Nest_lounge_eld.jpg",
|
||||
},
|
||||
captions: [
|
||||
{
|
||||
src: './video/captions_en.vtt',
|
||||
src: "./video/captions_en.vtt",
|
||||
srcLang: Lang.en,
|
||||
isDefault: false,
|
||||
},
|
||||
{
|
||||
src: './video/captions_sv.vtt',
|
||||
src: "./video/captions_sv.vtt",
|
||||
srcLang: Lang.sv,
|
||||
isDefault: false,
|
||||
},
|
||||
@@ -124,25 +124,25 @@ const videoProps = {
|
||||
}
|
||||
|
||||
const quoteCardProps = {
|
||||
variant: 'quote' as const,
|
||||
quote: 'Download our membership App for smoother & richer experience',
|
||||
author: 'Hans Christian Andersen',
|
||||
authorDescription: 'The famed Danish storyteller.',
|
||||
variant: "quote" as const,
|
||||
quote: "Download our membership App for smoother & richer experience",
|
||||
author: "Hans Christian Andersen",
|
||||
authorDescription: "The famed Danish storyteller.",
|
||||
video: videoProps,
|
||||
}
|
||||
|
||||
const textCardProps = {
|
||||
variant: 'text' as const,
|
||||
heading: 'Download our membership App now',
|
||||
text: 'Hans Christian Andersen, the famed Danish storyteller, spent many years of his life in Nyhavn, drawing inspiration from its lively atmosphere and picturesque setting.',
|
||||
variant: "text" as const,
|
||||
heading: "Download our membership App now",
|
||||
text: "Hans Christian Andersen, the famed Danish storyteller, spent many years of his life in Nyhavn, drawing inspiration from its lively atmosphere and picturesque setting.",
|
||||
video: videoProps,
|
||||
}
|
||||
|
||||
const smallDecorator = (Story: React.FC) => (
|
||||
<div
|
||||
style={{
|
||||
width: '792px',
|
||||
paddingRight: '2rem',
|
||||
width: "792px",
|
||||
paddingRight: "2rem",
|
||||
}}
|
||||
>
|
||||
<Story />
|
||||
@@ -152,8 +152,8 @@ const smallDecorator = (Story: React.FC) => (
|
||||
const largeDecorator = (Story: React.FC) => (
|
||||
<div
|
||||
style={{
|
||||
width: '1200px',
|
||||
paddingRight: '2rem',
|
||||
width: "1200px",
|
||||
paddingRight: "2rem",
|
||||
}}
|
||||
>
|
||||
<Story />
|
||||
@@ -163,7 +163,7 @@ const largeDecorator = (Story: React.FC) => (
|
||||
export const QuotePrimary1Small: Story = {
|
||||
args: {
|
||||
...quoteCardProps,
|
||||
style: 'primary-1',
|
||||
style: "primary-1",
|
||||
},
|
||||
decorators: [smallDecorator],
|
||||
render: (args) => <VideoWithCard {...args} />,
|
||||
@@ -172,7 +172,7 @@ export const QuotePrimary1Small: Story = {
|
||||
export const QuotePrimary2Small: Story = {
|
||||
args: {
|
||||
...quoteCardProps,
|
||||
style: 'primary-2',
|
||||
style: "primary-2",
|
||||
},
|
||||
decorators: [smallDecorator],
|
||||
render: (args) => <VideoWithCard {...args} />,
|
||||
@@ -181,7 +181,7 @@ export const QuotePrimary2Small: Story = {
|
||||
export const TextPrimary1Small: Story = {
|
||||
args: {
|
||||
...textCardProps,
|
||||
style: 'primary-1',
|
||||
style: "primary-1",
|
||||
},
|
||||
decorators: [smallDecorator],
|
||||
render: (args) => <VideoWithCard {...args} />,
|
||||
@@ -190,7 +190,7 @@ export const TextPrimary1Small: Story = {
|
||||
export const TextPrimary2Small: Story = {
|
||||
args: {
|
||||
...textCardProps,
|
||||
style: 'primary-2',
|
||||
style: "primary-2",
|
||||
},
|
||||
decorators: [smallDecorator],
|
||||
render: (args) => <VideoWithCard {...args} />,
|
||||
@@ -199,7 +199,7 @@ export const TextPrimary2Small: Story = {
|
||||
export const QuotePrimary1Large: Story = {
|
||||
args: {
|
||||
...quoteCardProps,
|
||||
style: 'primary-1',
|
||||
style: "primary-1",
|
||||
},
|
||||
decorators: [largeDecorator],
|
||||
render: (args) => <VideoWithCard {...args} />,
|
||||
@@ -208,7 +208,7 @@ export const QuotePrimary1Large: Story = {
|
||||
export const QuotePrimary2Large: Story = {
|
||||
args: {
|
||||
...quoteCardProps,
|
||||
style: 'primary-2',
|
||||
style: "primary-2",
|
||||
},
|
||||
decorators: [largeDecorator],
|
||||
render: (args) => <VideoWithCard {...args} />,
|
||||
@@ -217,7 +217,7 @@ export const QuotePrimary2Large: Story = {
|
||||
export const TextPrimary1Large: Story = {
|
||||
args: {
|
||||
...textCardProps,
|
||||
style: 'primary-1',
|
||||
style: "primary-1",
|
||||
},
|
||||
decorators: [largeDecorator],
|
||||
render: (args) => <VideoWithCard {...args} />,
|
||||
@@ -226,7 +226,7 @@ export const TextPrimary1Large: Story = {
|
||||
export const TextPrimary2Large: Story = {
|
||||
args: {
|
||||
...textCardProps,
|
||||
style: 'primary-2',
|
||||
style: "primary-2",
|
||||
},
|
||||
decorators: [largeDecorator],
|
||||
render: (args) => <VideoWithCard {...args} />,
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
import { VariantProps } from 'class-variance-authority'
|
||||
import { Typography } from '../../Typography'
|
||||
import { variants } from './variants'
|
||||
import { VariantProps } from "class-variance-authority"
|
||||
import { Typography } from "../../Typography"
|
||||
import { variants } from "./variants"
|
||||
|
||||
import { VideoPlayer } from '..'
|
||||
import { VideoPlayerProps } from '../types'
|
||||
import styles from './videoWithCard.module.css'
|
||||
import { VideoPlayer } from ".."
|
||||
import { VideoPlayerProps } from "../types"
|
||||
import styles from "./videoWithCard.module.css"
|
||||
interface TextCardProps {
|
||||
variant: 'text'
|
||||
variant: "text"
|
||||
heading: string
|
||||
text?: string
|
||||
}
|
||||
interface QuoteCardProps {
|
||||
variant: 'quote'
|
||||
variant: "quote"
|
||||
quote: string
|
||||
author: string
|
||||
authorDescription?: string
|
||||
@@ -19,7 +19,7 @@ interface QuoteCardProps {
|
||||
|
||||
type VideoWithCardProps = VariantProps<typeof variants> &
|
||||
(TextCardProps | QuoteCardProps) & {
|
||||
video: Pick<VideoPlayerProps, 'sources' | 'captions' | 'focalPoint'>
|
||||
video: Pick<VideoPlayerProps, "sources" | "captions" | "focalPoint">
|
||||
}
|
||||
|
||||
export function VideoWithCard(props: VideoWithCardProps) {
|
||||
@@ -42,7 +42,7 @@ export function VideoWithCard(props: VideoWithCardProps) {
|
||||
}
|
||||
|
||||
function CardContent(props: VideoWithCardProps) {
|
||||
if (props.variant === 'quote') {
|
||||
if (props.variant === "quote") {
|
||||
const { quote, author, authorDescription } = props
|
||||
|
||||
return (
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
import { cva } from 'class-variance-authority'
|
||||
import { cva } from "class-variance-authority"
|
||||
|
||||
import styles from './videoWithCard.module.css'
|
||||
import styles from "./videoWithCard.module.css"
|
||||
|
||||
export const config = {
|
||||
variants: {
|
||||
variant: {
|
||||
text: styles['variant-text'],
|
||||
quote: styles['variant-quote'],
|
||||
text: styles["variant-text"],
|
||||
quote: styles["variant-quote"],
|
||||
},
|
||||
style: {
|
||||
'primary-1': styles['style-primary-1'],
|
||||
'primary-2': styles['style-primary-2'],
|
||||
"primary-1": styles["style-primary-1"],
|
||||
"primary-2": styles["style-primary-2"],
|
||||
},
|
||||
},
|
||||
defaultVariants: {
|
||||
style: 'primary-1',
|
||||
variant: 'text',
|
||||
style: "primary-1",
|
||||
variant: "text",
|
||||
},
|
||||
} as const
|
||||
|
||||
|
||||
+2
-2
@@ -71,10 +71,10 @@
|
||||
|
||||
.blockquote {
|
||||
&::before {
|
||||
content: '“';
|
||||
content: "“";
|
||||
}
|
||||
&::after {
|
||||
content: '”';
|
||||
content: "”";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user