Merged in chore/cleanup-unused (pull request #3461)
chore: Cleanup unused vars, exports, types * Cleanup some unused exports * Remove more * Readd CampaignPageIncludedHotelsRef * Add alias comment to procedure exports * Remove unused exports Approved-by: Linus Flood
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import { cva } from "class-variance-authority"
|
||||
|
||||
import { deepmerge } from "deepmerge-ts"
|
||||
import styles from "./chip-button.module.css"
|
||||
import { config as typographyConfig } from "../Typography/variants"
|
||||
|
||||
@@ -106,14 +105,3 @@ export const config = {
|
||||
}
|
||||
|
||||
export const variants = cva(styles.chip, config)
|
||||
|
||||
const chipConfig = {
|
||||
variants: {
|
||||
...config.variants,
|
||||
},
|
||||
defaultVariants: config.defaultVariants,
|
||||
} as const
|
||||
|
||||
export function withChipButton<T>(config: T) {
|
||||
return deepmerge(chipConfig, config)
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ import { cva } from "class-variance-authority"
|
||||
|
||||
import styles from "./chip-static.module.css"
|
||||
|
||||
export const config = {
|
||||
const config = {
|
||||
variants: {
|
||||
color: {
|
||||
Subtle: styles["color-subtle"],
|
||||
|
||||
@@ -16,6 +16,3 @@ export type CountryProps = {
|
||||
disabled?: boolean
|
||||
registerOptions?: RegisterOptions
|
||||
}
|
||||
|
||||
export type CountryPortalContainer = HTMLDivElement | undefined
|
||||
export type CountryPortalContainerArgs = HTMLDivElement | null
|
||||
|
||||
@@ -2,7 +2,6 @@ import { Lang } from "@scandic-hotels/common/constants/language"
|
||||
import type { RegisterOptions } from "react-hook-form"
|
||||
|
||||
export const enum DateName {
|
||||
date = "date",
|
||||
day = "day",
|
||||
month = "month",
|
||||
year = "year",
|
||||
|
||||
@@ -96,6 +96,3 @@ export const FormTextArea = forwardRef<HTMLTextAreaElement, FormTextAreaProps>(
|
||||
)
|
||||
|
||||
FormTextArea.displayName = "FormTextArea"
|
||||
|
||||
// Default export for backwards compatibility
|
||||
export default FormTextArea
|
||||
|
||||
@@ -2,7 +2,7 @@ import { cva } from "class-variance-authority"
|
||||
|
||||
import styles from "./imageCounter.module.css"
|
||||
|
||||
export const config = {
|
||||
const config = {
|
||||
variants: {
|
||||
size: {
|
||||
Large: styles.large,
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import type { Lang } from "@scandic-hotels/common/constants/language"
|
||||
|
||||
import type { EmbedTypesEnum, RTEItemType, RTEItemTypeEnum } from "./enums"
|
||||
import type { RTEItemType } from "./enums"
|
||||
|
||||
export interface Attributes {
|
||||
[key: string]: unknown
|
||||
@@ -9,47 +7,7 @@ export interface Attributes {
|
||||
style?: { [key: string]: unknown } | undefined
|
||||
}
|
||||
|
||||
export interface RTEAssetAttrs extends Attributes {
|
||||
alt: string
|
||||
"asset-alt": string
|
||||
"asset-link": string
|
||||
"asset-name": string
|
||||
"asset-type": "image/png" | "image/jpg" | "image/jpeg"
|
||||
"asset-uid": string
|
||||
"display-type": EmbedTypesEnum.display
|
||||
"content-type-uid": "sys_assets"
|
||||
inline: false
|
||||
type: RTEItemTypeEnum.asset
|
||||
}
|
||||
|
||||
export interface RTEAnchorAttrs extends Attributes {
|
||||
target: string
|
||||
url: string
|
||||
}
|
||||
|
||||
export interface RTELinkAttrs extends Attributes {
|
||||
"display-type": EmbedTypesEnum.link
|
||||
"class-name": string
|
||||
"content-type-uid": string
|
||||
"entry-uid": string
|
||||
locale: Lang
|
||||
href: string
|
||||
target: HTMLAnchorElement["target"]
|
||||
type: RTEItemTypeEnum.entry
|
||||
}
|
||||
|
||||
export interface RTEImageVaultAttrs extends Attributes {
|
||||
height: string
|
||||
// style: string[]
|
||||
width: string
|
||||
id: number
|
||||
title: string
|
||||
url: string
|
||||
dimensions: {
|
||||
width: number
|
||||
height: number
|
||||
aspectRatio: number
|
||||
}
|
||||
meta: { alt: string | undefined | null; caption: string | undefined | null }
|
||||
focalPoint: { x: number; y: number }
|
||||
}
|
||||
|
||||
@@ -1,13 +1,3 @@
|
||||
export enum EmbedTypesEnum {
|
||||
block = "block",
|
||||
display = "display",
|
||||
download = "download",
|
||||
inline = "inline",
|
||||
link = "link",
|
||||
}
|
||||
|
||||
export type EmbedTypes = keyof typeof EmbedTypesEnum
|
||||
|
||||
/** Copied from https://github.com/contentstack/contentstack-utils-javascript/blob/master/src/nodes/node-type.ts */
|
||||
export enum RTETypeEnum {
|
||||
a = "a",
|
||||
@@ -45,8 +35,6 @@ export enum RTETypeEnum {
|
||||
fragment = "fragment",
|
||||
}
|
||||
|
||||
export type RTEType = keyof typeof RTETypeEnum
|
||||
|
||||
export enum RTEItemTypeEnum {
|
||||
asset = "asset",
|
||||
entry = "entry",
|
||||
|
||||
@@ -5,12 +5,7 @@ import {
|
||||
ImageVaultAssetResponse,
|
||||
} from "@scandic-hotels/common/utils/imageVault"
|
||||
import type { EmbedByUid } from "../../JsonToHtml"
|
||||
import type {
|
||||
Attributes,
|
||||
RTEAnchorAttrs,
|
||||
RTEAssetAttrs,
|
||||
RTELinkAttrs,
|
||||
} from "./attrs"
|
||||
import type { Attributes, RTEAnchorAttrs } from "./attrs"
|
||||
import type { RTETypeEnum } from "./enums"
|
||||
import type { RenderOptions } from "./option"
|
||||
|
||||
@@ -21,26 +16,11 @@ export interface RTEDefaultNode {
|
||||
uid: string
|
||||
}
|
||||
|
||||
export interface RTELinkNode {
|
||||
attrs: Attributes
|
||||
children: RTENode[]
|
||||
type: RTETypeEnum
|
||||
uid: string
|
||||
}
|
||||
|
||||
export interface RTEReferenceAssetNode extends RTEDefaultNode {
|
||||
attrs: RTEAssetAttrs
|
||||
}
|
||||
|
||||
export interface RTEAnchorNode extends RTEDefaultNode {
|
||||
interface RTEAnchorNode extends RTEDefaultNode {
|
||||
attrs: RTEAnchorAttrs
|
||||
type: RTETypeEnum.a
|
||||
}
|
||||
|
||||
export interface RTEReferenceLinkNode extends RTEDefaultNode {
|
||||
attrs: RTELinkAttrs
|
||||
}
|
||||
|
||||
export interface RTEImageVaultNode extends RTEDefaultNode {
|
||||
attrs: Attributes &
|
||||
(DeprecatedImageVaultAssetResponse | ImageVaultAssetResponse)
|
||||
@@ -73,7 +53,7 @@ export type RTERegularNode = RTEDefaultNode | RTEAnchorNode | RTEImageVaultNode
|
||||
|
||||
export type RTEImageNode = RTEDefaultNode | RTEImageVaultNode
|
||||
|
||||
export type RTEReferenceNode = RTEAnchorNode
|
||||
type RTEReferenceNode = RTEAnchorNode
|
||||
|
||||
export type RTENode = RTERegularNode | RTEReferenceNode | RTETextNode
|
||||
|
||||
@@ -83,11 +63,6 @@ export type RTERenderMark = (
|
||||
id?: string
|
||||
) => JSX.Element
|
||||
|
||||
export interface RTEDocument extends RTEDefaultNode {
|
||||
type: RTETypeEnum.doc
|
||||
_version: number
|
||||
}
|
||||
|
||||
export type RTERenderOptionComponent = (
|
||||
node: RTERegularNode,
|
||||
embeds: EmbedByUid,
|
||||
|
||||
@@ -18,7 +18,7 @@ import {
|
||||
} from "./types/rte/node"
|
||||
import type { RenderOptions } from "./types/rte/option"
|
||||
|
||||
export function groupEmbedsByUid(embedsArray: Node<Embeds>[]) {
|
||||
function groupEmbedsByUid(embedsArray: Node<Embeds>[]) {
|
||||
const embedsByUid = embedsArray.reduce<EmbedByUid>((acc, embed) => {
|
||||
if ("system" in embed.node && embed.node.system?.uid) {
|
||||
acc[embed.node.system.uid] = embed
|
||||
@@ -29,7 +29,7 @@ export function groupEmbedsByUid(embedsArray: Node<Embeds>[]) {
|
||||
return embedsByUid
|
||||
}
|
||||
|
||||
export function nodeChildrenToHtml(
|
||||
function nodeChildrenToHtml(
|
||||
nodes: RTENode[],
|
||||
embeds: EmbedByUid,
|
||||
fullRenderOptions: RenderOptions
|
||||
@@ -51,10 +51,7 @@ export function nodeChildrenToHtml(
|
||||
.filter(Boolean)
|
||||
}
|
||||
|
||||
export function textNodeToHtml(
|
||||
node: RTETextNode,
|
||||
fullRenderOptions: RenderOptions
|
||||
) {
|
||||
function textNodeToHtml(node: RTETextNode, fullRenderOptions: RenderOptions) {
|
||||
let text = <>{node.text}</>
|
||||
|
||||
if (node.classname || node.id) {
|
||||
@@ -116,7 +113,7 @@ export function extractAvailableListClassNames(className?: string) {
|
||||
.map((item) => styles[item] || item)
|
||||
}
|
||||
|
||||
export function nodeToHtml(
|
||||
function nodeToHtml(
|
||||
node: RTENode,
|
||||
embeds: EmbedByUid,
|
||||
fullRenderOptions: RenderOptions
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
import { useMemo } from "react"
|
||||
import { LightboxImage } from ".."
|
||||
|
||||
export const THUMBNAIL_WINDOW = 5
|
||||
export const THUMBNAIL_OFFSET = Math.ceil(THUMBNAIL_WINDOW / 2)
|
||||
const THUMBNAIL_WINDOW = 5
|
||||
const THUMBNAIL_OFFSET = Math.ceil(THUMBNAIL_WINDOW / 2)
|
||||
|
||||
interface useThumbnailProps {
|
||||
images: LightboxImage[]
|
||||
|
||||
@@ -12,7 +12,7 @@ import { PoiMarker } from "../../Markers/PoiMarker"
|
||||
import styles from "./poiMapMarkers.module.css"
|
||||
import { MarkerInfo, PointOfInterest } from "../../types"
|
||||
|
||||
export type PoiMapMarkersProps = {
|
||||
type PoiMapMarkersProps = {
|
||||
activePoi?: string | null
|
||||
coordinates: { lat: number; lng: number }
|
||||
onActivePoiChange?: (poiName: string | null) => void
|
||||
|
||||
@@ -2,7 +2,7 @@ import { cva } from "class-variance-authority"
|
||||
|
||||
import styles from "./radio.module.css"
|
||||
|
||||
export const config = {
|
||||
const config = {
|
||||
variants: {
|
||||
color: {
|
||||
Burgundy: styles["color-burgundy"],
|
||||
|
||||
@@ -21,16 +21,3 @@ export const slideInOut = {
|
||||
transition: { duration: 0.4, ease: "easeInOut" },
|
||||
},
|
||||
} as const
|
||||
|
||||
export const slideFromTop = {
|
||||
hidden: {
|
||||
opacity: 0,
|
||||
y: -32,
|
||||
transition: { duration: 0.4, ease: "easeInOut" },
|
||||
},
|
||||
visible: {
|
||||
opacity: 1,
|
||||
y: 0,
|
||||
transition: { duration: 0.4, ease: "easeInOut" },
|
||||
},
|
||||
} as const
|
||||
|
||||
@@ -2,7 +2,7 @@ import { cva } from "class-variance-authority"
|
||||
|
||||
import styles from "./rate-card.module.css"
|
||||
|
||||
export const config = {
|
||||
const config = {
|
||||
variants: {
|
||||
variant: {
|
||||
Regular: styles["variant-regular"],
|
||||
|
||||
@@ -5,7 +5,6 @@ import {
|
||||
withTypography,
|
||||
} from "../Typography/variants"
|
||||
|
||||
import { deepmerge } from "deepmerge-ts"
|
||||
import styles from "./textLink.module.css"
|
||||
|
||||
export const config = {
|
||||
@@ -33,7 +32,3 @@ const textLinkConfig = {
|
||||
} as const
|
||||
|
||||
export const variants = cva(styles.textLink, withTypography(textLinkConfig))
|
||||
|
||||
export function withTextLink<T>(config: T) {
|
||||
return deepmerge(textLinkConfig, config)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user