Files
web/apps/scandic-web/components/TempDesignSystem/ShowMoreButton/index.tsx
Joakim Jäderberg aafad9781f Merged in feat/lokalise-rebuild (pull request #2993)
Feat/lokalise rebuild

* chore(lokalise): update translation ids

* chore(lokalise): easier to switch between projects

* chore(lokalise): update translation ids

* .

* .

* .

* .

* .

* .

* chore(lokalise): update translation ids

* chore(lokalise): update translation ids

* .

* .

* .

* chore(lokalise): update translation ids

* chore(lokalise): update translation ids

* .

* .

* chore(lokalise): update translation ids

* chore(lokalise): update translation ids

* chore(lokalise): new translations

* merge

* switch to errors for missing id's

* merge

* sync translations


Approved-by: Linus Flood
2025-10-22 11:00:03 +00:00

67 lines
1.5 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({
id: "common.showMore",
defaultMessage: "Show more",
})
}
if (!textShowLess) {
textShowLess = intl.formatMessage({
id: "common.showLess",
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>
)
}