Files
web/apps/scandic-web/components/TempDesignSystem/ShowMoreButton/index.tsx
Matilda Landström 5de2a993a7 Merged in feat/SW-1711-switch-icons (pull request #1558)
Switches out all the old icons to new ones, and moves them to the design system. The new icons are of three different types: Materialise Symbol, Nucleo, and Customized. Also adds further mapping between facilities/amenities and icons.

Approved-by: Michael Zetterberg
Approved-by: Erik Tiekstra
2025-03-27 09:42:52 +00:00

66 lines
1.4 KiB
TypeScript

"use client"
import { useIntl } from "react-intl"
import { MaterialIcon } from "@scandic-hotels/design-system/Icons"
import Button from "@/components/TempDesignSystem/Button"
import { showMoreButtonVariants } from "./variants"
import styles from "./showMoreButton.module.css"
import type { ShowMoreButtonProps } from "./showMoreButton"
export default function ShowMoreButton({
className,
buttonIntent,
intent,
disabled,
showLess,
textShowMore,
textShowLess,
loadMoreData,
}: ShowMoreButtonProps) {
const intl = useIntl()
const classNames = showMoreButtonVariants({
className,
buttonIntent,
})
if (!textShowMore) {
textShowMore = intl.formatMessage({
id: "Show more",
})
}
if (!textShowLess) {
textShowLess = intl.formatMessage({
id: "Show less",
})
}
return (
<div className={`${classNames} ${showLess ? styles.showLess : ""}`}>
<Button
className={styles.button}
disabled={disabled}
onClick={loadMoreData}
variant="icon"
type="button"
theme="base"
intent={intent ?? "text"}
fullWidth={intent ? true : false}
size={intent && "small"}
>
<MaterialIcon
icon="keyboard_arrow_down"
className={styles.icon}
color="CurrentColor"
/>
{showLess ? textShowLess : textShowMore}
</Button>
</div>
)
}