feat(SW-440) implemented changes to buttons according to figma
This commit is contained in:
@@ -55,6 +55,7 @@ export default function MapCard({ hotelName, pois }: MapCardProps) {
|
|||||||
theme="base"
|
theme="base"
|
||||||
intent="secondary"
|
intent="secondary"
|
||||||
size="small"
|
size="small"
|
||||||
|
fullWidth
|
||||||
className={styles.ctaButton}
|
className={styles.ctaButton}
|
||||||
onClick={openDynamicMap}
|
onClick={openDynamicMap}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
.btn {
|
.btn {
|
||||||
background: none;
|
background: none;
|
||||||
/* No variable yet for radius 50px */
|
border-radius: var(--Corner-radius-Rounded);
|
||||||
border-radius: 50px;
|
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
@@ -10,12 +9,12 @@
|
|||||||
background-color 300ms ease,
|
background-color 300ms ease,
|
||||||
color 300ms ease;
|
color 300ms ease;
|
||||||
|
|
||||||
/* TODO: Waiting for variables for buttons from Design team */
|
|
||||||
font-family: var(--typography-Body-Bold-fontFamily);
|
font-family: var(--typography-Body-Bold-fontFamily);
|
||||||
font-size: var(--typography-Body-Bold-fontSize);
|
font-size: var(--typography-Body-Bold-fontSize);
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
line-height: 24px;
|
line-height: var(--typography-Body-Bold-lineHeight);
|
||||||
letter-spacing: 0.6%;
|
letter-spacing: 0.6%;
|
||||||
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.wrapping {
|
.wrapping {
|
||||||
@@ -23,6 +22,10 @@
|
|||||||
padding-right: 0 !important;
|
padding-right: 0 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.fullWidth {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
/* INTENT */
|
/* INTENT */
|
||||||
.primary,
|
.primary,
|
||||||
a.primary {
|
a.primary {
|
||||||
@@ -70,20 +73,32 @@ a.default {
|
|||||||
|
|
||||||
/* SIZES */
|
/* SIZES */
|
||||||
.btn.small {
|
.btn.small {
|
||||||
|
font-size: var(--typography-Caption-Bold-fontSize);
|
||||||
|
line-height: var(--typography-Caption-Bold-lineHeight);
|
||||||
gap: var(--Spacing-x-quarter);
|
gap: var(--Spacing-x-quarter);
|
||||||
height: 40px;
|
padding: calc(var(--Spacing-x1) + 2px) var(--Spacing-x2); /* Special case padding to adjust the missing border */
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn.small.secondary {
|
||||||
padding: var(--Spacing-x1) var(--Spacing-x2);
|
padding: var(--Spacing-x1) var(--Spacing-x2);
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn.medium {
|
.btn.medium {
|
||||||
gap: var(--Spacing-x-half);
|
gap: var(--Spacing-x-half);
|
||||||
height: 48px;
|
padding: calc(var(--Spacing-x-one-and-half) + 2px) var(--Spacing-x2); /* Special case padding to adjust the missing border */
|
||||||
|
}
|
||||||
|
|
||||||
|
.medium.secondary {
|
||||||
padding: var(--Spacing-x-one-and-half) var(--Spacing-x2);
|
padding: var(--Spacing-x-one-and-half) var(--Spacing-x2);
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn.large {
|
.btn.large {
|
||||||
gap: var(--Spacing-x-half);
|
gap: var(--Spacing-x-half);
|
||||||
height: 56px;
|
padding: calc(var(--Spacing-x2) + 2px) var(--Spacing-x3); /* Special case padding to adjust the missing border */
|
||||||
|
}
|
||||||
|
|
||||||
|
.large.secondary {
|
||||||
|
gap: var(--Spacing-x-half);
|
||||||
padding: var(--Spacing-x2) var(--Spacing-x3);
|
padding: var(--Spacing-x2) var(--Spacing-x3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,14 +8,23 @@ import { buttonVariants } from "./variants"
|
|||||||
import type { ButtonProps } from "./button"
|
import type { ButtonProps } from "./button"
|
||||||
|
|
||||||
export default function Button(props: ButtonProps) {
|
export default function Button(props: ButtonProps) {
|
||||||
const { className, intent, size, theme, wrapping, variant, ...restProps } =
|
const {
|
||||||
props
|
className,
|
||||||
|
intent,
|
||||||
|
size,
|
||||||
|
theme,
|
||||||
|
fullWidth,
|
||||||
|
wrapping,
|
||||||
|
variant,
|
||||||
|
...restProps
|
||||||
|
} = props
|
||||||
|
|
||||||
const classNames = buttonVariants({
|
const classNames = buttonVariants({
|
||||||
className,
|
className,
|
||||||
intent,
|
intent,
|
||||||
size,
|
size,
|
||||||
theme,
|
theme,
|
||||||
|
fullWidth,
|
||||||
wrapping,
|
wrapping,
|
||||||
variant,
|
variant,
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -33,6 +33,9 @@ export const buttonVariants = cva(styles.btn, {
|
|||||||
wrapping: {
|
wrapping: {
|
||||||
true: styles.wrapping,
|
true: styles.wrapping,
|
||||||
},
|
},
|
||||||
|
fullWidth: {
|
||||||
|
true: styles.fullWidth,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
defaultVariants: {
|
defaultVariants: {
|
||||||
intent: "primary",
|
intent: "primary",
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
|
import Link from "next/link"
|
||||||
|
|
||||||
import Image from "@/components/Image"
|
import Image from "@/components/Image"
|
||||||
import Button from "@/components/TempDesignSystem/Button"
|
import Button from "@/components/TempDesignSystem/Button"
|
||||||
import Link from "@/components/TempDesignSystem/Link"
|
|
||||||
import BiroScript from "@/components/TempDesignSystem/Text/BiroScript"
|
import BiroScript from "@/components/TempDesignSystem/Text/BiroScript"
|
||||||
import Body from "@/components/TempDesignSystem/Text/Body"
|
import Body from "@/components/TempDesignSystem/Text/Body"
|
||||||
import Title from "@/components/TempDesignSystem/Text/Title"
|
import Title from "@/components/TempDesignSystem/Text/Title"
|
||||||
@@ -26,7 +27,7 @@ export default function Card({
|
|||||||
onPrimaryButtonClick,
|
onPrimaryButtonClick,
|
||||||
onSecondaryButtonClick,
|
onSecondaryButtonClick,
|
||||||
}: CardProps) {
|
}: CardProps) {
|
||||||
const { buttonTheme, primaryLinkColor, secondaryLinkColor } = getTheme(theme)
|
const buttonTheme = getTheme(theme)
|
||||||
|
|
||||||
imageHeight = imageHeight || 320
|
imageHeight = imageHeight || 320
|
||||||
imageWidth =
|
imageWidth =
|
||||||
@@ -85,7 +86,6 @@ export default function Card({
|
|||||||
<Link
|
<Link
|
||||||
href={primaryButton.href}
|
href={primaryButton.href}
|
||||||
target={primaryButton.openInNewTab ? "_blank" : undefined}
|
target={primaryButton.openInNewTab ? "_blank" : undefined}
|
||||||
color={primaryLinkColor}
|
|
||||||
onClick={onPrimaryButtonClick}
|
onClick={onPrimaryButtonClick}
|
||||||
>
|
>
|
||||||
{primaryButton.title}
|
{primaryButton.title}
|
||||||
@@ -103,7 +103,6 @@ export default function Card({
|
|||||||
<Link
|
<Link
|
||||||
href={secondaryButton.href}
|
href={secondaryButton.href}
|
||||||
target={secondaryButton.openInNewTab ? "_blank" : undefined}
|
target={secondaryButton.openInNewTab ? "_blank" : undefined}
|
||||||
color={secondaryLinkColor}
|
|
||||||
onClick={onSecondaryButtonClick}
|
onClick={onSecondaryButtonClick}
|
||||||
>
|
>
|
||||||
{secondaryButton.title}
|
{secondaryButton.title}
|
||||||
|
|||||||
@@ -1,53 +1,21 @@
|
|||||||
import type { ButtonProps } from "@/components/TempDesignSystem/Button/button"
|
import type { ButtonProps } from "@/components/TempDesignSystem/Button/button"
|
||||||
import type { CardProps } from "@/components/TempDesignSystem/Card/card"
|
import type { CardProps } from "@/components/TempDesignSystem/Card/card"
|
||||||
import type { LinkProps } from "@/components/TempDesignSystem/Link/link"
|
|
||||||
|
|
||||||
export function getTheme(theme: CardProps["theme"]) {
|
|
||||||
let buttonTheme: ButtonProps["theme"] = "primaryLight"
|
|
||||||
let primaryLinkColor: LinkProps["color"] = "pale"
|
|
||||||
let secondaryLinkColor: LinkProps["color"] = "burgundy"
|
|
||||||
|
|
||||||
|
export function getTheme(theme: CardProps["theme"]): ButtonProps["theme"] {
|
||||||
switch (theme) {
|
switch (theme) {
|
||||||
case "one":
|
|
||||||
buttonTheme = "primaryLight"
|
|
||||||
primaryLinkColor = "pale"
|
|
||||||
secondaryLinkColor = "burgundy"
|
|
||||||
break
|
|
||||||
case "two":
|
case "two":
|
||||||
buttonTheme = "secondaryLight"
|
return "secondaryLight"
|
||||||
primaryLinkColor = "pale"
|
|
||||||
secondaryLinkColor = "burgundy"
|
|
||||||
break
|
|
||||||
case "three":
|
case "three":
|
||||||
buttonTheme = "tertiaryLight"
|
return "tertiaryLight"
|
||||||
primaryLinkColor = "pale"
|
|
||||||
secondaryLinkColor = "burgundy"
|
|
||||||
break
|
|
||||||
case "primaryDark":
|
case "primaryDark":
|
||||||
buttonTheme = "primaryDark"
|
return "primaryDark"
|
||||||
primaryLinkColor = "burgundy"
|
|
||||||
secondaryLinkColor = "pale"
|
|
||||||
break
|
|
||||||
case "primaryDim":
|
|
||||||
buttonTheme = "primaryLight"
|
|
||||||
primaryLinkColor = "pale"
|
|
||||||
secondaryLinkColor = "burgundy"
|
|
||||||
break
|
|
||||||
case "primaryInverted":
|
|
||||||
buttonTheme = "primaryLight"
|
|
||||||
primaryLinkColor = "pale"
|
|
||||||
secondaryLinkColor = "burgundy"
|
|
||||||
break
|
|
||||||
case "primaryStrong":
|
case "primaryStrong":
|
||||||
case "image":
|
case "image":
|
||||||
buttonTheme = "primaryStrong"
|
return "primaryStrong"
|
||||||
primaryLinkColor = "red"
|
case "one":
|
||||||
secondaryLinkColor = "white"
|
case "primaryDim":
|
||||||
}
|
case "primaryInverted":
|
||||||
|
default:
|
||||||
return {
|
return "primaryLight"
|
||||||
buttonTheme: buttonTheme,
|
|
||||||
primaryLinkColor: primaryLinkColor,
|
|
||||||
secondaryLinkColor: secondaryLinkColor,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user