chore(SW-3665): Upgrade to Next 16 * Upgrade partner-sas * Upgrade scandic-web to next 16 * Update peerDep versions * Fix revalidateTag * Remove comment * Merge branch 'master' into chore/upgrade-to-next16 * Update netlify adapter * Build with webpack instead of turbopack * Revert from proxy to middleware * Merge branch 'master' into chore/upgrade-to-next16 * Revert proxy type * Fix react types versions * 16.0.9 * Bump to 16.0.10 Approved-by: Linus Flood
34 lines
893 B
TypeScript
34 lines
893 B
TypeScript
import { mapRewardToIcon } from "./data"
|
|
|
|
import type { LogoAndIllustrationProps } from "@scandic-hotels/design-system/Icons"
|
|
|
|
interface RewardIconProps extends LogoAndIllustrationProps {
|
|
rewardId: string
|
|
iconSize?: "small" | "medium" | "large"
|
|
}
|
|
|
|
// Original SVG aspect ratio is 358:202 (≈1.77:1)
|
|
const sizeMap = {
|
|
small: { width: 120, height: 68 }, // 40% of card width
|
|
medium: { width: 180, height: 102 }, // 60% of card width
|
|
large: { width: 240, height: 135 }, // 80% of card width
|
|
} as const
|
|
|
|
export function RewardIcon({
|
|
rewardId,
|
|
iconSize = "medium",
|
|
...props
|
|
}: RewardIconProps) {
|
|
const IconComponent = mapRewardToIcon(rewardId)
|
|
if (!IconComponent) return null
|
|
|
|
return (
|
|
// eslint-disable-next-line react-hooks/static-components
|
|
<IconComponent
|
|
{...props}
|
|
width={sizeMap[iconSize].width}
|
|
height={sizeMap[iconSize].height}
|
|
/>
|
|
)
|
|
}
|