feat(SW-441): Added table block component
This commit is contained in:
@@ -1,4 +0,0 @@
|
||||
.container {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
@@ -5,18 +5,29 @@ import { useIntl } from "react-intl"
|
||||
import { ChevronDownIcon } from "@/components/Icons"
|
||||
import Button from "@/components/TempDesignSystem/Button"
|
||||
|
||||
import styles from "./button.module.css"
|
||||
import { showMoreButtonVariants } from "./variants"
|
||||
|
||||
import type { ShowMoreButtonParams } from "@/types/components/myPages/stays/button"
|
||||
import styles from "./showMoreButton.module.css"
|
||||
|
||||
import type { ShowMoreButtonProps } from "./showMoreButton"
|
||||
|
||||
export default function ShowMoreButton({
|
||||
className,
|
||||
intent,
|
||||
disabled,
|
||||
showLess,
|
||||
loadMoreData,
|
||||
}: ShowMoreButtonParams) {
|
||||
const { formatMessage } = useIntl()
|
||||
}: ShowMoreButtonProps) {
|
||||
const intl = useIntl()
|
||||
const classNames = showMoreButtonVariants({
|
||||
className,
|
||||
intent,
|
||||
})
|
||||
|
||||
return (
|
||||
<div className={styles.container}>
|
||||
<div className={`${classNames} ${showLess ? styles.showLess : ""}`}>
|
||||
<Button
|
||||
className={styles.button}
|
||||
disabled={disabled}
|
||||
onClick={loadMoreData}
|
||||
variant="icon"
|
||||
@@ -24,8 +35,8 @@ export default function ShowMoreButton({
|
||||
theme="base"
|
||||
intent="text"
|
||||
>
|
||||
<ChevronDownIcon />
|
||||
{formatMessage({ id: "Show more" })}
|
||||
<ChevronDownIcon className={styles.icon} />
|
||||
{intl.formatMessage({ id: showLess ? "Show less" : "Show more" })}
|
||||
</Button>
|
||||
</div>
|
||||
)
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
.container {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.table {
|
||||
display: grid;
|
||||
justify-content: stretch;
|
||||
border-top: 1px solid var(--Base-Border-Subtle);
|
||||
background-color: var(--Base-Surface-Primary-light-Normal);
|
||||
}
|
||||
|
||||
.table .button {
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
.icon {
|
||||
transition: transform 0.3s;
|
||||
}
|
||||
|
||||
.showLess .icon {
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
11
components/TempDesignSystem/ShowMoreButton/showMoreButton.ts
Normal file
11
components/TempDesignSystem/ShowMoreButton/showMoreButton.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { showMoreButtonVariants } from "./variants"
|
||||
|
||||
import type { VariantProps } from "class-variance-authority"
|
||||
|
||||
export interface ShowMoreButtonProps
|
||||
extends React.PropsWithChildren<React.HTMLAttributes<HTMLDivElement>>,
|
||||
VariantProps<typeof showMoreButtonVariants> {
|
||||
disabled?: boolean
|
||||
showLess?: boolean
|
||||
loadMoreData: () => void
|
||||
}
|
||||
11
components/TempDesignSystem/ShowMoreButton/variants.ts
Normal file
11
components/TempDesignSystem/ShowMoreButton/variants.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { cva } from "class-variance-authority"
|
||||
|
||||
import styles from "./showMoreButton.module.css"
|
||||
|
||||
export const showMoreButtonVariants = cva(styles.container, {
|
||||
variants: {
|
||||
intent: {
|
||||
table: styles.table,
|
||||
},
|
||||
},
|
||||
})
|
||||
Reference in New Issue
Block a user