Files
web/apps/scandic-web/components/TempDesignSystem/ShowMoreButton/index.tsx
Erik Tiekstra 333636c81a Merged in feat/BOOK-61-refactor-hotel-page-css-variables (pull request #3014)
Feat/BOOK-61 refactor hotel page css variables

* feat(BOOK-61): Breadcrumbs

* feat(BOOK-61): intro section

* feat(BOOK-61): show more button

* feat(BOOK-61): rooms section

* feat(BOOK-61): sidepeeks

* feat(BOOK-61): deprecated old Link component

* feat(BOOK-61): added new TextLink component to the design-system

* feat(BOOK-61): replaced deprecated links with new TextLink component

* feat(BOOK-61): miscellaneous changes


Approved-by: Bianca Widstam
Approved-by: Christel Westerberg
2025-10-29 09:15:03 +00:00

67 lines
1.4 KiB
TypeScript

"use client"
import { useIntl } from "react-intl"
import { Button } from "@scandic-hotels/design-system/Button"
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
import type { ComponentProps } from "react"
interface ShowMoreButtonProps extends ComponentProps<typeof Button> {
showLess?: boolean
textShowMore?: string
textShowLess?: string
loadMoreData: () => void
}
export default function ShowMoreButton({
variant = "Text",
color = "Primary",
size = "Medium",
typography = "Body/Paragraph/mdBold",
showLess,
textShowMore,
textShowLess,
loadMoreData,
...props
}: ShowMoreButtonProps) {
const intl = useIntl()
if (!textShowMore) {
textShowMore = intl.formatMessage({
id: "common.showMore",
defaultMessage: "Show more",
})
}
if (!textShowLess) {
textShowLess = intl.formatMessage({
id: "common.showLess",
defaultMessage: "Show less",
})
}
return (
<Button
variant={variant}
color={color}
size={size}
onPress={loadMoreData}
typography={typography}
{...props}
>
{showLess ? (
<>
<MaterialIcon icon="keyboard_arrow_up" color="CurrentColor" />
<span>{textShowLess}</span>
</>
) : (
<>
<MaterialIcon icon="keyboard_arrow_down" color="CurrentColor" />
<span>{textShowMore}</span>
</>
)}
</Button>
)
}