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,22 +1,22 @@
|
||||
import type { Meta, StoryObj } from '@storybook/nextjs-vite'
|
||||
import { MessageBanner } from './index'
|
||||
import type { Meta, StoryObj } from "@storybook/nextjs-vite"
|
||||
import { MessageBanner } from "./index"
|
||||
|
||||
type MessageBannerType = 'default' | 'error' | 'info'
|
||||
type TextColor = 'default' | 'error'
|
||||
type MessageBannerType = "default" | "error" | "info"
|
||||
type TextColor = "default" | "error"
|
||||
|
||||
const meta: Meta<typeof MessageBanner> = {
|
||||
title: 'Core Components/MessageBanner',
|
||||
title: "Core Components/MessageBanner",
|
||||
component: MessageBanner,
|
||||
argTypes: {
|
||||
type: {
|
||||
control: { type: 'select' },
|
||||
options: ['default', 'error', 'info'] as MessageBannerType[],
|
||||
control: { type: "select" },
|
||||
options: ["default", "error", "info"] as MessageBannerType[],
|
||||
},
|
||||
textColor: {
|
||||
control: { type: 'select' },
|
||||
options: ['default', 'error'] as TextColor[],
|
||||
control: { type: "select" },
|
||||
options: ["default", "error"] as TextColor[],
|
||||
},
|
||||
text: { control: 'text' },
|
||||
text: { control: "text" },
|
||||
},
|
||||
}
|
||||
|
||||
@@ -25,40 +25,40 @@ type Story = StoryObj<typeof MessageBanner>
|
||||
|
||||
export const Default: Story = {
|
||||
args: {
|
||||
type: 'default',
|
||||
textColor: 'default',
|
||||
text: 'This is a default message',
|
||||
type: "default",
|
||||
textColor: "default",
|
||||
text: "This is a default message",
|
||||
},
|
||||
}
|
||||
|
||||
export const Warning: Story = {
|
||||
args: {
|
||||
type: 'error',
|
||||
textColor: 'default',
|
||||
text: 'This is a warning message',
|
||||
type: "error",
|
||||
textColor: "default",
|
||||
text: "This is a warning message",
|
||||
},
|
||||
}
|
||||
|
||||
export const WarningErrorText: Story = {
|
||||
args: {
|
||||
type: 'error',
|
||||
textColor: 'error',
|
||||
text: 'Warning with error text color',
|
||||
type: "error",
|
||||
textColor: "error",
|
||||
text: "Warning with error text color",
|
||||
},
|
||||
}
|
||||
|
||||
export const Info: Story = {
|
||||
args: {
|
||||
type: 'info',
|
||||
textColor: 'default',
|
||||
text: 'This is an info message',
|
||||
type: "info",
|
||||
textColor: "default",
|
||||
text: "This is an info message",
|
||||
},
|
||||
}
|
||||
|
||||
export const InfoErrorText: Story = {
|
||||
args: {
|
||||
type: 'info',
|
||||
textColor: 'error',
|
||||
text: 'Info with error text color',
|
||||
type: "info",
|
||||
textColor: "error",
|
||||
text: "Info with error text color",
|
||||
},
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { cva } from 'class-variance-authority'
|
||||
import styles from './messageBanner.module.css'
|
||||
import { Typography } from '../Typography'
|
||||
import { MaterialIcon } from '../Icons/MaterialIcon'
|
||||
import { cva } from "class-variance-authority"
|
||||
import styles from "./messageBanner.module.css"
|
||||
import { Typography } from "../Typography"
|
||||
import { MaterialIcon } from "../Icons/MaterialIcon"
|
||||
|
||||
type MessageBannerType = 'default' | 'error' | 'info'
|
||||
type TextColor = 'default' | 'error'
|
||||
type MessageBannerType = "default" | "error" | "info"
|
||||
type TextColor = "default" | "error"
|
||||
|
||||
const textVariants = cva('', {
|
||||
const textVariants = cva("", {
|
||||
variants: {
|
||||
textColor: {
|
||||
default: styles.textDefault,
|
||||
@@ -14,7 +14,7 @@ const textVariants = cva('', {
|
||||
},
|
||||
},
|
||||
defaultVariants: {
|
||||
textColor: 'default',
|
||||
textColor: "default",
|
||||
},
|
||||
})
|
||||
|
||||
@@ -25,19 +25,19 @@ type MessageBannerProps = {
|
||||
}
|
||||
|
||||
export function MessageBanner({
|
||||
type = 'default',
|
||||
textColor = 'default',
|
||||
type = "default",
|
||||
textColor = "default",
|
||||
text,
|
||||
}: MessageBannerProps) {
|
||||
const textClass = textVariants({ textColor })
|
||||
|
||||
const iconName = type === 'error' ? 'error' : 'info'
|
||||
const iconName = type === "error" ? "error" : "info"
|
||||
const iconColor =
|
||||
type === 'error'
|
||||
? 'Icon/Feedback/Error'
|
||||
: type === 'info'
|
||||
? 'Icon/Feedback/Information'
|
||||
: 'Icon/Default'
|
||||
type === "error"
|
||||
? "Icon/Feedback/Error"
|
||||
: type === "info"
|
||||
? "Icon/Feedback/Information"
|
||||
: "Icon/Default"
|
||||
|
||||
return (
|
||||
<div className={styles.container}>
|
||||
|
||||
Reference in New Issue
Block a user