Merged in feat/sw-3247-move-table-to-design-system (pull request #2636)
feat(SW-3247): Move Table component to design-system * Move Table component to design-system Approved-by: Bianca Widstam
This commit is contained in:
@@ -5,12 +5,12 @@ import { useIntl } from "react-intl"
|
|||||||
|
|
||||||
import { dt } from "@scandic-hotels/common/dt"
|
import { dt } from "@scandic-hotels/common/dt"
|
||||||
import Link from "@scandic-hotels/design-system/Link"
|
import Link from "@scandic-hotels/design-system/Link"
|
||||||
|
import Table from "@scandic-hotels/design-system/Table"
|
||||||
import { Typography } from "@scandic-hotels/design-system/Typography"
|
import { Typography } from "@scandic-hotels/design-system/Typography"
|
||||||
import { Transactions } from "@scandic-hotels/trpc/enums/transactions"
|
import { Transactions } from "@scandic-hotels/trpc/enums/transactions"
|
||||||
|
|
||||||
import { webviews } from "@/constants/routes/webviews"
|
import { webviews } from "@/constants/routes/webviews"
|
||||||
|
|
||||||
import Table from "@/components/TempDesignSystem/Table"
|
|
||||||
import useLang from "@/hooks/useLang"
|
import useLang from "@/hooks/useLang"
|
||||||
|
|
||||||
import AwardPoints from "../../../AwardPoints"
|
import AwardPoints from "../../../AwardPoints"
|
||||||
|
|||||||
@@ -2,10 +2,9 @@
|
|||||||
|
|
||||||
import { useIntl } from "react-intl"
|
import { useIntl } from "react-intl"
|
||||||
|
|
||||||
|
import Table from "@scandic-hotels/design-system/Table"
|
||||||
import { Typography } from "@scandic-hotels/design-system/Typography"
|
import { Typography } from "@scandic-hotels/design-system/Typography"
|
||||||
|
|
||||||
import Table from "@/components/TempDesignSystem/Table"
|
|
||||||
|
|
||||||
import Row from "./Row"
|
import Row from "./Row"
|
||||||
|
|
||||||
import styles from "./clientTable.module.css"
|
import styles from "./clientTable.module.css"
|
||||||
|
|||||||
@@ -3,9 +3,9 @@
|
|||||||
import { useIntl } from "react-intl"
|
import { useIntl } from "react-intl"
|
||||||
|
|
||||||
import { dt } from "@scandic-hotels/common/dt"
|
import { dt } from "@scandic-hotels/common/dt"
|
||||||
|
import Table from "@scandic-hotels/design-system/Table"
|
||||||
import { Typography } from "@scandic-hotels/design-system/Typography"
|
import { Typography } from "@scandic-hotels/design-system/Typography"
|
||||||
|
|
||||||
import Table from "@/components/TempDesignSystem/Table"
|
|
||||||
import useLang from "@/hooks/useLang"
|
import useLang from "@/hooks/useLang"
|
||||||
|
|
||||||
import AwardPoints from "../../EarnAndBurn/AwardPoints"
|
import AwardPoints from "../../EarnAndBurn/AwardPoints"
|
||||||
|
|||||||
@@ -8,11 +8,12 @@ import {
|
|||||||
} from "@tanstack/react-table"
|
} from "@tanstack/react-table"
|
||||||
import { useState } from "react"
|
import { useState } from "react"
|
||||||
|
|
||||||
|
import Table from "@scandic-hotels/design-system/Table"
|
||||||
|
|
||||||
import SectionContainer from "@/components/Section/Container"
|
import SectionContainer from "@/components/Section/Container"
|
||||||
import SectionHeader from "@/components/Section/Header"
|
import SectionHeader from "@/components/Section/Header"
|
||||||
import ScrollWrapper from "@/components/TempDesignSystem/ScrollWrapper"
|
import ScrollWrapper from "@/components/TempDesignSystem/ScrollWrapper"
|
||||||
import ShowMoreButton from "@/components/TempDesignSystem/ShowMoreButton"
|
import ShowMoreButton from "@/components/TempDesignSystem/ShowMoreButton"
|
||||||
import Table from "@/components/TempDesignSystem/Table"
|
|
||||||
|
|
||||||
import styles from "./table.module.css"
|
import styles from "./table.module.css"
|
||||||
|
|
||||||
|
|||||||
@@ -2,10 +2,9 @@ import { ElementType } from "domelementtype"
|
|||||||
import parse, { type DOMNode, Element, type Text } from "html-react-parser"
|
import parse, { type DOMNode, Element, type Text } from "html-react-parser"
|
||||||
|
|
||||||
import Link from "@scandic-hotels/design-system/Link"
|
import Link from "@scandic-hotels/design-system/Link"
|
||||||
|
import Table from "@scandic-hotels/design-system/Table"
|
||||||
import { Typography } from "@scandic-hotels/design-system/Typography"
|
import { Typography } from "@scandic-hotels/design-system/Typography"
|
||||||
|
|
||||||
import Table from "@/components/TempDesignSystem/Table"
|
|
||||||
|
|
||||||
import { NodeNames } from "./utils"
|
import { NodeNames } from "./utils"
|
||||||
|
|
||||||
import styles from "./htmlContent.module.css"
|
import styles from "./htmlContent.module.css"
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import Image from "@scandic-hotels/design-system/Image"
|
|||||||
import ImageContainer from "@scandic-hotels/design-system/ImageContainer"
|
import ImageContainer from "@scandic-hotels/design-system/ImageContainer"
|
||||||
import Link from "@scandic-hotels/design-system/Link"
|
import Link from "@scandic-hotels/design-system/Link"
|
||||||
import Subtitle from "@scandic-hotels/design-system/Subtitle"
|
import Subtitle from "@scandic-hotels/design-system/Subtitle"
|
||||||
|
import Table from "@scandic-hotels/design-system/Table"
|
||||||
import Title from "@scandic-hotels/design-system/Title"
|
import Title from "@scandic-hotels/design-system/Title"
|
||||||
import {
|
import {
|
||||||
AvailableParagraphFormatEnum,
|
AvailableParagraphFormatEnum,
|
||||||
@@ -15,7 +16,6 @@ import {
|
|||||||
} from "@scandic-hotels/trpc/types/RTEenums"
|
} from "@scandic-hotels/trpc/types/RTEenums"
|
||||||
import { insertResponseToImageVaultAsset } from "@scandic-hotels/trpc/utils/imageVault"
|
import { insertResponseToImageVaultAsset } from "@scandic-hotels/trpc/utils/imageVault"
|
||||||
|
|
||||||
import Table from "../TempDesignSystem/Table"
|
|
||||||
import BiroScript from "../TempDesignSystem/Text/BiroScript"
|
import BiroScript from "../TempDesignSystem/Text/BiroScript"
|
||||||
import { hasAvailableParagraphFormat, hasAvailableULFormat } from "./utils"
|
import { hasAvailableParagraphFormat, hasAvailableULFormat } from "./utils"
|
||||||
|
|
||||||
|
|||||||
@@ -5,11 +5,11 @@ import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
|
|||||||
import Image from "@scandic-hotels/design-system/Image"
|
import Image from "@scandic-hotels/design-system/Image"
|
||||||
import ImageContainer from "@scandic-hotels/design-system/ImageContainer"
|
import ImageContainer from "@scandic-hotels/design-system/ImageContainer"
|
||||||
import Link from "@scandic-hotels/design-system/Link"
|
import Link from "@scandic-hotels/design-system/Link"
|
||||||
|
import Table from "@scandic-hotels/design-system/Table"
|
||||||
import { Typography } from "@scandic-hotels/design-system/Typography"
|
import { Typography } from "@scandic-hotels/design-system/Typography"
|
||||||
import { ContentEnum } from "@scandic-hotels/trpc/types/content"
|
import { ContentEnum } from "@scandic-hotels/trpc/types/content"
|
||||||
import { insertResponseToImageVaultAsset } from "@scandic-hotels/trpc/utils/imageVault"
|
import { insertResponseToImageVaultAsset } from "@scandic-hotels/trpc/utils/imageVault"
|
||||||
|
|
||||||
import Table from "../TempDesignSystem/Table"
|
|
||||||
import {
|
import {
|
||||||
hasAvailableParagraphFormat,
|
hasAvailableParagraphFormat,
|
||||||
hasAvailableULFormat,
|
hasAvailableULFormat,
|
||||||
|
|||||||
@@ -1,13 +0,0 @@
|
|||||||
import styles from "./table.module.css"
|
|
||||||
|
|
||||||
import type { THeadProps } from "./table"
|
|
||||||
|
|
||||||
function TH({ children, width = "auto", ...props }: THeadProps) {
|
|
||||||
return (
|
|
||||||
<th className={styles.th} style={{ width }} {...props}>
|
|
||||||
{children}
|
|
||||||
</th>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
export default TH
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import styles from "./table.module.css"
|
import styles from './table.module.css'
|
||||||
|
|
||||||
function TBody({ children }: React.PropsWithChildren) {
|
function TBody({ children }: React.PropsWithChildren) {
|
||||||
return <tbody className={styles.tbody}>{children}</tbody>
|
return <tbody className={styles.tbody}>{children}</tbody>
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import styles from "./table.module.css"
|
import styles from './table.module.css'
|
||||||
|
|
||||||
function TD({
|
function TD({
|
||||||
children,
|
children,
|
||||||
13
packages/design-system/lib/components/Table/TH.tsx
Normal file
13
packages/design-system/lib/components/Table/TH.tsx
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
import styles from './table.module.css'
|
||||||
|
|
||||||
|
import type { THeadProps } from './table'
|
||||||
|
|
||||||
|
function TH({ children, width = 'auto', ...props }: THeadProps) {
|
||||||
|
return (
|
||||||
|
<th className={styles.th} style={{ width }} {...props}>
|
||||||
|
{children}
|
||||||
|
</th>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default TH
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import styles from "./table.module.css"
|
import styles from './table.module.css'
|
||||||
|
|
||||||
function THead({ children }: React.PropsWithChildren) {
|
function THead({ children }: React.PropsWithChildren) {
|
||||||
return <thead className={styles.thead}>{children}</thead>
|
return <thead className={styles.thead}>{children}</thead>
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import styles from "./table.module.css"
|
import styles from './table.module.css'
|
||||||
|
|
||||||
function TR({
|
function TR({
|
||||||
children,
|
children,
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
import TBody from "./TBody"
|
import TBody from './TBody'
|
||||||
import TD from "./TD"
|
import TD from './TD'
|
||||||
import TH from "./TH"
|
import TH from './TH'
|
||||||
import THead from "./THead"
|
import THead from './THead'
|
||||||
import TR from "./TR"
|
import TR from './TR'
|
||||||
import { tableVariants } from "./variants"
|
import { tableVariants } from './variants'
|
||||||
|
|
||||||
import type { TableProps } from "./table"
|
import type { TableProps } from './table'
|
||||||
|
|
||||||
function Table({
|
function Table({
|
||||||
className,
|
className,
|
||||||
@@ -13,7 +13,7 @@ function Table({
|
|||||||
borderRadius,
|
borderRadius,
|
||||||
variant,
|
variant,
|
||||||
layout,
|
layout,
|
||||||
width = "100%",
|
width = '100%',
|
||||||
children,
|
children,
|
||||||
...props
|
...props
|
||||||
}: TableProps) {
|
}: TableProps) {
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import type { VariantProps } from "class-variance-authority"
|
import type { VariantProps } from 'class-variance-authority'
|
||||||
|
|
||||||
import type { tableVariants } from "./variants"
|
import type { tableVariants } from './variants'
|
||||||
|
|
||||||
export interface TableProps
|
export interface TableProps
|
||||||
extends React.PropsWithChildren<React.HTMLAttributes<HTMLTableElement>>,
|
extends React.PropsWithChildren<React.HTMLAttributes<HTMLTableElement>>,
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import { cva } from "class-variance-authority"
|
import { cva } from 'class-variance-authority'
|
||||||
|
|
||||||
import styles from "./table.module.css"
|
import styles from './table.module.css'
|
||||||
|
|
||||||
export const tableVariants = cva(styles.table, {
|
export const tableVariants = cva(styles.table, {
|
||||||
variants: {
|
variants: {
|
||||||
@@ -12,7 +12,7 @@ export const tableVariants = cva(styles.table, {
|
|||||||
content: styles.content,
|
content: styles.content,
|
||||||
},
|
},
|
||||||
borderRadius: {
|
borderRadius: {
|
||||||
none: "",
|
none: '',
|
||||||
small: styles.smallRadius,
|
small: styles.smallRadius,
|
||||||
medium: styles.mediumRadius,
|
medium: styles.mediumRadius,
|
||||||
large: styles.largeRadius,
|
large: styles.largeRadius,
|
||||||
@@ -22,6 +22,6 @@ export const tableVariants = cva(styles.table, {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
defaultVariants: {
|
defaultVariants: {
|
||||||
borderRadius: "medium",
|
borderRadius: 'medium',
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@@ -41,6 +41,7 @@
|
|||||||
"./SidePeek/SidePeekProvider": "./lib/components/SidePeek/SidePeekContext/SidePeekProvider.tsx",
|
"./SidePeek/SidePeekProvider": "./lib/components/SidePeek/SidePeekContext/SidePeekProvider.tsx",
|
||||||
"./Subtitle": "./lib/components/Subtitle/index.tsx",
|
"./Subtitle": "./lib/components/Subtitle/index.tsx",
|
||||||
"./Switch": "./lib/components/Switch/index.tsx",
|
"./Switch": "./lib/components/Switch/index.tsx",
|
||||||
|
"./Table": "./lib/components/Table/index.tsx",
|
||||||
"./Title": "./lib/components/Title/index.tsx",
|
"./Title": "./lib/components/Title/index.tsx",
|
||||||
"./Tooltip": "./lib/components/Tooltip/index.tsx",
|
"./Tooltip": "./lib/components/Tooltip/index.tsx",
|
||||||
"./Typography": "./lib/components/Typography/index.tsx",
|
"./Typography": "./lib/components/Typography/index.tsx",
|
||||||
|
|||||||
Reference in New Issue
Block a user