diff --git a/apps/scandic-web/components/Blocks/DynamicContent/Rewards/NextLevel/index.tsx b/apps/scandic-web/components/Blocks/DynamicContent/Rewards/NextLevel/index.tsx index ce4e4254c..5ed851de3 100644 --- a/apps/scandic-web/components/Blocks/DynamicContent/Rewards/NextLevel/index.tsx +++ b/apps/scandic-web/components/Blocks/DynamicContent/Rewards/NextLevel/index.tsx @@ -1,7 +1,7 @@ import { Lock } from "react-feather" import { MembershipLevelEnum } from "@scandic-hotels/common/constants/membershipLevels" -import Chip from "@scandic-hotels/design-system/Chip" +import { ChipStatic } from "@scandic-hotels/design-system/ChipStatic" import { Typography } from "@scandic-hotels/design-system/Typography" import { getMembershipLevel } from "@/lib/trpc/memoizedRequests" @@ -46,13 +46,13 @@ export default async function NextLevelRewardsBlock({ {nextLevelRewards.rewards.map((reward) => (
- + {intl.formatMessage({ id: "rewards.nextLevel.levelUpToUnlock", defaultMessage: "Level up to unlock", })} - +
{promoText ? ( - {promoText} + + {promoText} + ) : null}
diff --git a/apps/scandic-web/components/ContentType/DestinationPage/ExperienceList/index.tsx b/apps/scandic-web/components/ContentType/DestinationPage/ExperienceList/index.tsx index b1018121d..9d1ffa0ca 100644 --- a/apps/scandic-web/components/ContentType/DestinationPage/ExperienceList/index.tsx +++ b/apps/scandic-web/components/ContentType/DestinationPage/ExperienceList/index.tsx @@ -2,7 +2,7 @@ import { useIntl } from "react-intl" -import Chip from "@scandic-hotels/design-system/Chip" +import { ChipStatic } from "@scandic-hotels/design-system/ChipStatic" import { mapExperiencesToListData } from "./utils" @@ -25,10 +25,10 @@ export default function ExperienceList({ experiences }: ExperienceListProps) {
    {experienceList.map(({ Icon, name }) => (
  • - + {name} - +
  • ))}
diff --git a/apps/scandic-web/components/ContentType/DestinationPage/HotelMapCard/DialogImage/index.tsx b/apps/scandic-web/components/ContentType/DestinationPage/HotelMapCard/DialogImage/index.tsx index 97dc0ce62..714dd7abf 100644 --- a/apps/scandic-web/components/ContentType/DestinationPage/HotelMapCard/DialogImage/index.tsx +++ b/apps/scandic-web/components/ContentType/DestinationPage/HotelMapCard/DialogImage/index.tsx @@ -1,8 +1,7 @@ -import Chip from "@scandic-hotels/design-system/Chip" +import { ChipStatic } from "@scandic-hotels/design-system/ChipStatic" import TripadvisorIcon from "@scandic-hotels/design-system/Icons/TripadvisorIcon" import Image from "@scandic-hotels/design-system/Image" import ImageFallback from "@scandic-hotels/design-system/ImageFallback" -import { Typography } from "@scandic-hotels/design-system/Typography" import styles from "./dialogImage.module.css" @@ -34,12 +33,10 @@ export default function DialogImage({ )} {rating ? (
- + - - {rating} - - + {rating} +
) : null}
diff --git a/packages/design-system/lib/components/Chip/chip.module.css b/packages/design-system/lib/components/Chip/chip.module.css deleted file mode 100644 index 1d035db3d..000000000 --- a/packages/design-system/lib/components/Chip/chip.module.css +++ /dev/null @@ -1,43 +0,0 @@ -div.chip { - --chip-text-color: var(--Base-Text-High-contrast); - --chip-background-color: var(--Base-Surface-Primary-light-Normal); - align-items: center; - color: var(--chip-text-color); - background-color: var(--chip-background-color); - border-radius: var(--Corner-radius-sm); - display: flex; - gap: var(--Space-x05); - justify-content: center; -} - -.chip.small { - padding: var(--Space-x025) var(--Space-x05); -} - -.chip.medium { - padding: var(--Space-x05) var(--Space-x1); -} - -.chip *, -.chip svg * { - fill: var(--chip-text-color); -} - -.chip.burgundy { - --chip-text-color: var(--Primary-Dark-On-Surface-Text); - --chip-background-color: var(--Base-Text-High-contrast); -} - -.chip.transparent { - --chip-text-color: var(--UI-Input-Controls-On-Fill-Normal); - --chip-background-color: rgba(64, 57, 55, 0.9); -} - -.chip.tag { - --chip-background-color: var(--Base-Surface-Subtle-Hover); -} - -.chip.uiTextHighContrast { - --chip-background-color: var(--UI-Text-High-contrast); - --chip-text-color: var(--UI-Input-Controls-On-Fill-Normal); -} diff --git a/packages/design-system/lib/components/Chip/index.tsx b/packages/design-system/lib/components/Chip/index.tsx deleted file mode 100644 index 830c0753e..000000000 --- a/packages/design-system/lib/components/Chip/index.tsx +++ /dev/null @@ -1,30 +0,0 @@ -import { VariantProps } from "class-variance-authority" -import { chipVariants } from "./variants" -import Footnote from "../Footnote" - -export interface ChipProps - extends - React.HtmlHTMLAttributes, - VariantProps {} - -/** - * @deprecated Do not use - */ - -export default function Chip({ - children, - className, - size, - variant, -}: ChipProps) { - const classNames = chipVariants({ - className, - size, - variant, - }) - return ( - -
{children}
-
- ) -} diff --git a/packages/design-system/lib/components/Chip/variants.ts b/packages/design-system/lib/components/Chip/variants.ts deleted file mode 100644 index dd9223d2a..000000000 --- a/packages/design-system/lib/components/Chip/variants.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { cva } from "class-variance-authority" - -import styles from "./chip.module.css" - -export const chipVariants = cva(styles.chip, { - variants: { - size: { - small: styles.small, - medium: styles.medium, - }, - variant: { - default: styles.default, - burgundy: styles.burgundy, - transparent: styles.transparent, - tag: styles.tag, - uiTextHighContrast: styles.uiTextHighContrast, - }, - }, - defaultVariants: { - size: "medium", - variant: "default", - }, -}) diff --git a/packages/design-system/lib/components/ChipStatic/ChipStatic.stories.tsx b/packages/design-system/lib/components/ChipStatic/ChipStatic.stories.tsx new file mode 100644 index 000000000..9dad8d4e0 --- /dev/null +++ b/packages/design-system/lib/components/ChipStatic/ChipStatic.stories.tsx @@ -0,0 +1,103 @@ +import type { Meta, StoryObj } from "@storybook/nextjs-vite" + +import { ChipStatic } from "./ChipStatic.tsx" +import { MaterialIcon } from "../Icons/MaterialIcon/MaterialIcon.tsx" + +const meta: Meta = { + title: "Core Components/ChipStatic", + component: ChipStatic, +} + +export default meta + +type Story = StoryObj + +export const Neutral: Story = { + render: () => ( +
+ + + lowerCase xs + + + + + + xs + + + + + + sm + + + + + + lg + + +
+ ), +} + +export const Subtle: Story = { + render: () => ( +
+ + + lowerCase xs + + + + + + xs + + + + + + sm + + + + + + lg + + +
+ ), +} + +export const Disabled: Story = { + render: () => ( +
+ + + lowerCase xs + + + + + + xs + + + + + + sm + + + + + + lg + + +
+ ), +} diff --git a/packages/design-system/lib/components/ChipStatic/ChipStatic.tsx b/packages/design-system/lib/components/ChipStatic/ChipStatic.tsx new file mode 100644 index 000000000..3ce3bf897 --- /dev/null +++ b/packages/design-system/lib/components/ChipStatic/ChipStatic.tsx @@ -0,0 +1,39 @@ +import { Typography } from "../Typography" + +import { variants } from "./variants" + +import type { TypographyProps } from "../Typography/types" +import type { VariantProps } from "class-variance-authority" +import type { ReactNode } from "react" + +import styles from "./chip-static.module.css" + +type ChipStaticProps = { + children: ReactNode + className?: string + lowerCase?: boolean +} & VariantProps + +export function ChipStatic({ + className, + color, + size, + lowerCase = false, + children, +}: ChipStaticProps) { + const classNames = variants({ className, color, size }) + const typographyVariant = getTypographyVariant(lowerCase) + + return ( + + {children} + + ) +} + +function getTypographyVariant(lowerCase: boolean): TypographyProps["variant"] { + if (lowerCase) { + return "Body/Supporting text (caption)/smRegular" + } + return "Tag/sm" +} diff --git a/packages/design-system/lib/components/ChipStatic/chip-static.module.css b/packages/design-system/lib/components/ChipStatic/chip-static.module.css new file mode 100644 index 000000000..a2b6073b8 --- /dev/null +++ b/packages/design-system/lib/components/ChipStatic/chip-static.module.css @@ -0,0 +1,35 @@ +.chip { + border-radius: var(--Corner-radius-sm); + padding: 0 var(--Space-x1); + display: inline-flex; + align-items: center; + gap: var(--Space-x05); +} + +.size-xs { + height: 24px; +} + +.size-sm { + height: 26px; +} + +.size-lg { + height: 32px; +} + +.color-subtle { + background-color: var(--Surface-Secondary-Subtle); + color: var(--Text-Interactive-Default); +} + +.color-disabled { + background-color: var(--Surface-UI-Fill-Disabled); + border: 1px solid var(--Border-Interactive-Disabled); + color: var(--Text-Interactive-Disabled); +} + +.color-neutral { + background-color: var(--Surface-Primary-Default); + color: var(--Text-Interactive-Default); +} diff --git a/packages/design-system/lib/components/ChipStatic/index.tsx b/packages/design-system/lib/components/ChipStatic/index.tsx new file mode 100644 index 000000000..af234dad8 --- /dev/null +++ b/packages/design-system/lib/components/ChipStatic/index.tsx @@ -0,0 +1 @@ +export { ChipStatic } from "./ChipStatic" diff --git a/packages/design-system/lib/components/ChipStatic/variants.ts b/packages/design-system/lib/components/ChipStatic/variants.ts new file mode 100644 index 000000000..57920cf34 --- /dev/null +++ b/packages/design-system/lib/components/ChipStatic/variants.ts @@ -0,0 +1,24 @@ +import { cva } from 'class-variance-authority' + +import styles from './chip-static.module.css' + +export const config = { + variants: { + color: { + Subtle: styles['color-subtle'], + Disabled: styles['color-disabled'], + Neutral: styles['color-neutral'], + }, + size: { + xs: styles['size-xs'], + sm: styles['size-sm'], + lg: styles['size-lg'], + }, + }, + defaultVariants: { + color: 'Neutral', + size: 'sm', + }, +} as const + +export const variants = cva(styles.chip, config) diff --git a/packages/design-system/package.json b/packages/design-system/package.json index 4a98c4566..8235d919f 100644 --- a/packages/design-system/package.json +++ b/packages/design-system/package.json @@ -16,10 +16,10 @@ "./CampaignRateCard": "./lib/components/RateCard/Campaign/index.tsx", "./Caption": "./lib/components/Caption/index.tsx", "./Card": "./lib/components/Card/index.tsx", - "./Chip": "./lib/components/Chip/index.tsx", "./ChipButton": "./lib/components/ChipButton/index.tsx", "./ChipLink": "./lib/components/ChipLink/index.tsx", "./Chips": "./lib/components/Chips/index.tsx", + "./ChipStatic": "./lib/components/ChipStatic/index.tsx", "./CodeRateCard": "./lib/components/RateCard/Code/index.tsx", "./DeprecatedSelect": "./lib/components/DeprecatedSelect/index.tsx", "./Divider": "./lib/components/Divider/index.tsx",