diff --git a/apps/scandic-web/components/GuestsRoomsPicker/Form.tsx b/apps/scandic-web/components/GuestsRoomsPicker/Form.tsx index 9ca0780e9..7c0f405a8 100644 --- a/apps/scandic-web/components/GuestsRoomsPicker/Form.tsx +++ b/apps/scandic-web/components/GuestsRoomsPicker/Form.tsx @@ -5,11 +5,11 @@ import { useFormContext, useWatch } from "react-hook-form" import { useIntl } from "react-intl" import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon" +import { Tooltip } from "@scandic-hotels/design-system/Tooltip" import { Typography } from "@scandic-hotels/design-system/Typography" import { SEARCH_TYPE_REDEMPTION } from "@scandic-hotels/trpc/constants/booking" import Button from "../TempDesignSystem/Button" -import { Tooltip } from "../TempDesignSystem/Tooltip" import { GuestsRoom } from "./GuestsRoom" import styles from "./guests-rooms-picker.module.css" diff --git a/apps/scandic-web/types/components/tooltip.ts b/apps/scandic-web/types/components/tooltip.ts deleted file mode 100644 index 622db4c2c..000000000 --- a/apps/scandic-web/types/components/tooltip.ts +++ /dev/null @@ -1,22 +0,0 @@ -export type TooltipPosition = "left" | "right" | "top" | "bottom" -type VerticalArrow = "top" | "bottom" | "center" -type HorizontalArrow = "left" | "right" | "center" - -type ValidArrowMap = { - left: VerticalArrow - right: VerticalArrow - top: HorizontalArrow - bottom: HorizontalArrow -} - -type ValidArrow
= P extends keyof ValidArrowMap - ? ValidArrowMap[P] - : never - -export interface TooltipProps
{ - heading?: string - text?: string - position: P - arrow: ValidArrow
- isTouchable?: boolean -} diff --git a/apps/scandic-web/components/TempDesignSystem/Tooltip/index.tsx b/packages/design-system/lib/components/Tooltip/index.tsx similarity index 57% rename from apps/scandic-web/components/TempDesignSystem/Tooltip/index.tsx rename to packages/design-system/lib/components/Tooltip/index.tsx index 7e79f5a58..5ce126a09 100644 --- a/apps/scandic-web/components/TempDesignSystem/Tooltip/index.tsx +++ b/packages/design-system/lib/components/Tooltip/index.tsx @@ -1,12 +1,32 @@ -import { type PropsWithChildren, useState } from "react" +import { type PropsWithChildren, useState } from 'react' -import Caption from "@scandic-hotels/design-system/Caption" +import { tooltipVariants } from './variants' -import { tooltipVariants } from "./variants" +import styles from './tooltip.module.css' +import Caption from '../Caption' -import styles from "./tooltip.module.css" +type TooltipPosition = 'left' | 'right' | 'top' | 'bottom' +type VerticalArrow = 'top' | 'bottom' | 'center' +type HorizontalArrow = 'left' | 'right' | 'center' -import type { TooltipPosition, TooltipProps } from "@/types/components/tooltip" +type ValidArrowMap = { + left: VerticalArrow + right: VerticalArrow + top: HorizontalArrow + bottom: HorizontalArrow +} + +type ValidArrow
= P extends keyof ValidArrowMap + ? ValidArrowMap[P] + : never + +interface TooltipProps
{ + heading?: string + text?: string + position: P + arrow: ValidArrow
+ isTouchable?: boolean +} export function Tooltip
({ heading, @@ -24,7 +44,7 @@ export function Tooltip
({
}
function handleKeyDown(event: React.KeyboardEvent