fix(BOOK-293): changed variants and props on IconButton component * fix(BOOK-293): changed variants and props on IconButton component * fix(BOOK-293): inherit color for icon Approved-by: Bianca Widstam Approved-by: Christel Westerberg
79 lines
2.3 KiB
TypeScript
79 lines
2.3 KiB
TypeScript
"use client"
|
|
|
|
import { useState } from "react"
|
|
import { useIntl } from "react-intl"
|
|
|
|
import { Button } from "@scandic-hotels/design-system/Button"
|
|
import ButtonLink from "@scandic-hotels/design-system/ButtonLink"
|
|
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
|
|
import { JsonToHtml } from "@scandic-hotels/design-system/JsonToHtml"
|
|
import SidePeek from "@scandic-hotels/design-system/SidePeek"
|
|
|
|
import styles from "./sidepeek.module.css"
|
|
|
|
import type { TeaserCardSidepeekProps } from "@/types/components/teaserCard"
|
|
|
|
export default function TeaserCardSidepeek({
|
|
button,
|
|
sidePeekContent,
|
|
}: TeaserCardSidepeekProps) {
|
|
const intl = useIntl()
|
|
const [sidePeekIsOpen, setSidePeekIsOpen] = useState(false)
|
|
const { heading, content, primary_button, secondary_button } = sidePeekContent
|
|
|
|
return (
|
|
<div className={styles.teaserCardSidepeek}>
|
|
<Button
|
|
onPress={() => setSidePeekIsOpen(true)}
|
|
variant="Secondary"
|
|
color="Primary"
|
|
size="sm"
|
|
>
|
|
{button.call_to_action_text}
|
|
<MaterialIcon icon="chevron_right" size={20} color="CurrentColor" />
|
|
</Button>
|
|
<SidePeek
|
|
title={heading}
|
|
isOpen={sidePeekIsOpen}
|
|
handleClose={() => setSidePeekIsOpen(false)}
|
|
openInRoot
|
|
closeLabel={intl.formatMessage({
|
|
id: "common.close",
|
|
defaultMessage: "Close",
|
|
})}
|
|
>
|
|
{content ? (
|
|
<JsonToHtml
|
|
nodes={content.json.children}
|
|
embeds={content.embedded_itemsConnection.edges}
|
|
/>
|
|
) : null}
|
|
<div className={styles.ctaContainer}>
|
|
{primary_button && (
|
|
<ButtonLink
|
|
variant="Primary"
|
|
color="Primary"
|
|
size="sm"
|
|
href={primary_button.href}
|
|
target={primary_button.openInNewTab ? "_blank" : undefined}
|
|
>
|
|
{primary_button.title}
|
|
</ButtonLink>
|
|
)}
|
|
{secondary_button && (
|
|
<ButtonLink
|
|
variant="Secondary"
|
|
color="Primary"
|
|
size="sm"
|
|
href={secondary_button.href}
|
|
target={secondary_button.openInNewTab ? "_blank" : undefined}
|
|
>
|
|
{secondary_button.title}
|
|
</ButtonLink>
|
|
)}
|
|
</div>
|
|
</SidePeek>
|
|
</div>
|
|
)
|
|
}
|