feat(SW-353): dynamic rewards

This commit is contained in:
Christel Westerberg
2024-09-25 15:59:16 +02:00
parent 6a85cfd19c
commit 56cd02f90b
78 changed files with 1568 additions and 4587 deletions

View File

@@ -0,0 +1,38 @@
import { MembershipLevelEnum } from "@/constants/membershipLevels"
import {
BestFriend,
CloseFriend,
DearFriend,
GoodFriend,
LoyalFriend,
NewFriend,
TrueFriend,
} from "@/components/Levels"
import type { MembershipLevelIconProps } from "@/types/components/myPages/membership"
export default function MembershipLevelIcon({
level,
color = "pale",
...props
}: MembershipLevelIconProps) {
switch (level) {
case MembershipLevelEnum.L1:
return <NewFriend color={color} {...props} />
case MembershipLevelEnum.L2:
return <GoodFriend color={color} {...props} />
case MembershipLevelEnum.L3:
return <CloseFriend color={color} {...props} />
case MembershipLevelEnum.L4:
return <DearFriend color={color} {...props} />
case MembershipLevelEnum.L5:
return <LoyalFriend color={color} {...props} />
case MembershipLevelEnum.L6:
return <TrueFriend color={color} {...props} />
case MembershipLevelEnum.L7:
return <BestFriend color={color} {...props} />
default:
return null
}
}

View File

@@ -2,7 +2,13 @@ import { levelVariants } from "../variants"
import type { LevelProps } from "../levels"
export default function BestFriend({ className, color, ...props }: LevelProps) {
export default function BestFriend({
className,
color,
height = "75",
width = "159",
...props
}: LevelProps) {
const classNames = levelVariants({
className,
color,
@@ -11,9 +17,9 @@ export default function BestFriend({ className, color, ...props }: LevelProps) {
<svg
className={classNames}
fill="none"
height="75"
height={height}
viewBox="0 0 159 75"
width="159"
width={width}
xmlns="http://www.w3.org/2000/svg"
{...props}
>

View File

@@ -5,6 +5,8 @@ import type { LevelProps } from "../levels"
export default function CloseFriend({
className,
color,
height = "75",
width = "158",
...props
}: LevelProps) {
const classNames = levelVariants({
@@ -15,9 +17,9 @@ export default function CloseFriend({
<svg
className={classNames}
fill="none"
height="75"
height={height}
viewBox="0 0 158 75"
width="158"
width={width}
xmlns="http://www.w3.org/2000/svg"
{...props}
>

View File

@@ -2,7 +2,13 @@ import { levelVariants } from "../variants"
import type { LevelProps } from "../levels"
export default function DearFriend({ className, color, ...props }: LevelProps) {
export default function DearFriend({
className,
color,
height = "75",
width = "159",
...props
}: LevelProps) {
const classNames = levelVariants({
className,
color,
@@ -11,9 +17,9 @@ export default function DearFriend({ className, color, ...props }: LevelProps) {
<svg
className={classNames}
fill="none"
height="75"
height={height}
viewBox="0 0 159 75"
width="159"
width={width}
xmlns="http://www.w3.org/2000/svg"
{...props}
>

View File

@@ -2,7 +2,13 @@ import { levelVariants } from "../variants"
import type { LevelProps } from "../levels"
export default function GoodFriend({ className, color, ...props }: LevelProps) {
export default function GoodFriend({
className,
color,
height = "75",
width = "159",
...props
}: LevelProps) {
const classNames = levelVariants({
className,
color,
@@ -11,9 +17,9 @@ export default function GoodFriend({ className, color, ...props }: LevelProps) {
<svg
className={classNames}
fill="none"
height="75"
height={height}
viewBox="0 0 159 75"
width="159"
width={width}
xmlns="http://www.w3.org/2000/svg"
{...props}
>

View File

@@ -5,6 +5,8 @@ import type { LevelProps } from "../levels"
export default function LoyalFriend({
className,
color,
height = "75",
width = "158",
...props
}: LevelProps) {
const classNames = levelVariants({
@@ -15,9 +17,9 @@ export default function LoyalFriend({
<svg
className={classNames}
fill="none"
height="75"
height={height}
viewBox="0 0 158 75"
width="158"
width={width}
xmlns="http://www.w3.org/2000/svg"
{...props}
>

View File

@@ -2,7 +2,13 @@ import { levelVariants } from "../variants"
import type { LevelProps } from "../levels"
export default function NewFriend({ className, color, ...props }: LevelProps) {
export default function NewFriend({
className,
color,
height = "75",
width = "159",
...props
}: LevelProps) {
const classNames = levelVariants({
className,
color,
@@ -11,9 +17,9 @@ export default function NewFriend({ className, color, ...props }: LevelProps) {
<svg
className={classNames}
fill="none"
height="75"
height={height}
viewBox="0 0 159 75"
width="159"
width={width}
xmlns="http://www.w3.org/2000/svg"
{...props}
>

View File

@@ -2,7 +2,13 @@ import { levelVariants } from "../variants"
import type { LevelProps } from "../levels"
export default function TrueFriend({ className, color, ...props }: LevelProps) {
export default function TrueFriend({
className,
color,
height = "75",
width = "159",
...props
}: LevelProps) {
const classNames = levelVariants({
className,
color,
@@ -11,9 +17,9 @@ export default function TrueFriend({ className, color, ...props }: LevelProps) {
<svg
className={classNames}
fill="none"
height="75"
height={height}
viewBox="0 0 159 75"
width="159"
width={width}
xmlns="http://www.w3.org/2000/svg"
{...props}
>

View File

@@ -4,4 +4,7 @@ import type { VariantProps } from "class-variance-authority"
export interface LevelProps
extends Omit<React.HTMLAttributes<HTMLOrSVGElement>, "color">,
VariantProps<typeof levelVariants> {}
VariantProps<typeof levelVariants> {
height?: string
width?: string
}