chore: SW-3145 Moved tempdesign button to design-system * chore: SW-3145 Moved tempdesign button to design-system Approved-by: Anton Gunnarsson
65 lines
1.4 KiB
TypeScript
65 lines
1.4 KiB
TypeScript
"use client"
|
|
|
|
import { useIntl } from "react-intl"
|
|
|
|
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
|
|
import { OldDSButton as Button } from "@scandic-hotels/design-system/OldDSButton"
|
|
|
|
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({
|
|
defaultMessage: "Show more",
|
|
})
|
|
}
|
|
|
|
if (!textShowLess) {
|
|
textShowLess = intl.formatMessage({
|
|
defaultMessage: "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>
|
|
)
|
|
}
|