-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32 from ReflectionsProjections/prizeSVG
Prize svg
- Loading branch information
Showing
17 changed files
with
14,446 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import React from "react"; | ||
import { View, Text } from "react-native"; | ||
import { StyledText } from "./Text"; | ||
|
||
import Question1 from "../assets/SVGs/myRP/blue-question.svg"; | ||
import Question2 from "../assets/SVGs/myRP/purple-question.svg"; | ||
import Question3 from "../assets/SVGs/myRP/pink-question.svg"; | ||
import Button from "../assets/SVGs/myRP/button.svg"; | ||
import ToteBag from "../assets/SVGs/myRP/tote-bag.svg"; | ||
import Cap from "../assets/SVGs/myRP/cap.svg"; | ||
|
||
interface PrizeSVGProps { | ||
prizeNum: number; | ||
attendeePoints: number; | ||
token: string; | ||
} | ||
|
||
const PrizeSVG: React.FC<PrizeSVGProps> = ({ | ||
prizeNum, | ||
attendeePoints, | ||
token, | ||
}) => { | ||
const size = 100; | ||
|
||
const getSVG = () => { | ||
if (token) { | ||
// Map SVGs based on prizeNum and attendeePoints | ||
const svgMap: { [key: number]: JSX.Element } = { | ||
1: attendeePoints >= 20 ? <Button width={size} height={size}/> : <Question1 width={size} height={size}/>, | ||
2: attendeePoints >= 35 ? <ToteBag width={size} height={size}/> : <Question2 width={size} height={size}/>, | ||
3: attendeePoints >= 50 ? <Cap width={size} height={size}/> : <Question3 width={size} height={size}/>, | ||
}; | ||
return svgMap[prizeNum] || <Text>No SVG available</Text>; | ||
} else { | ||
const svgMap: { [key: number]: JSX.Element } = { | ||
1: <Question1 width={size} height={size}/>, | ||
2: <Question2 width={size} height={size}/>, | ||
3: <Question3 width={size} height={size}/>, | ||
}; | ||
return svgMap[prizeNum] || <Text>No SVG available</Text>; | ||
} | ||
}; | ||
|
||
return getSVG(); | ||
}; | ||
|
||
export default PrizeSVG; |
File renamed without changes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.