-
Notifications
You must be signed in to change notification settings - Fork 0
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 #10 from KartikWatts/feature-the-searched-words-an…
…d-result-display Feature the searched words and result display
- Loading branch information
Showing
25 changed files
with
836 additions
and
83 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
Binary file not shown.
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,57 @@ | ||
import React, { useEffect, useState } from "react"; | ||
import tw from "twrnc"; | ||
import { View, Text, Dimensions, StyleSheet } from "react-native"; | ||
import { DEFAULT } from "../assets/data/Types"; | ||
import { Data } from "../assets/data/Interfaces"; | ||
|
||
const screen = Dimensions.get("screen"); | ||
|
||
function GameBoxDisplay(props: Data) { | ||
const getBoxColorFromState = (state: number) => { | ||
switch (state) { | ||
default: | ||
return `bg-blue-400`; | ||
} | ||
}; | ||
|
||
const [tileColor, setTileColor] = useState(getBoxColorFromState(DEFAULT)); | ||
|
||
useEffect(() => { | ||
setTileColor(getBoxColorFromState(props.tileState)); | ||
}, [props.tileState]); | ||
|
||
return ( | ||
<View | ||
style={[ | ||
styles.boxDimensions, | ||
tw`rounded-sm flex justify-center items-center`, | ||
tw`${tileColor}`, | ||
]} | ||
> | ||
<Text style={[styles.boxValue, tw`absolute top-0 left-1`]}> | ||
{props.value} | ||
</Text> | ||
<Text style={[styles.boxText]}>{props.letter}</Text> | ||
</View> | ||
); | ||
} | ||
|
||
const styles = StyleSheet.create({ | ||
boxDimensions: { | ||
width: (screen.width - 25 - 5 * 2.5) / 8, | ||
height: (screen.width - 25 - 5 * 2.5) / 8, | ||
margin: 0.8, | ||
elevation: 8, | ||
shadowColor: "black", | ||
borderColor: "black", | ||
borderWidth: 1, | ||
}, | ||
boxText: { | ||
fontSize: 15, | ||
}, | ||
boxValue: { | ||
fontSize: 6, | ||
}, | ||
}); | ||
|
||
export default GameBoxDisplay; |
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,42 @@ | ||
import React, { useState } from "react"; | ||
import { View, Text } from "react-native"; | ||
import tw from "twrnc"; | ||
|
||
import { ScoreProps } from "../assets/data/Types"; | ||
import CountDown from "./CountDown"; | ||
|
||
function ScoreDisplay(props: ScoreProps) { | ||
return ( | ||
<View style={tw`h-20 w-full mt-4 mb-4 flex flex-row items-center px-4`}> | ||
<View> | ||
<CountDown /> | ||
<View style={tw`w-30 px-2`}> | ||
<Text style={tw`text-slate-300 text-lg`}> | ||
Score:{" "} | ||
<Text style={tw`text-xl text-white`}> | ||
{props.score} | ||
</Text> | ||
</Text> | ||
</View> | ||
</View> | ||
<View style={tw`w-1/2 flex flex-col`}> | ||
<View style={tw`flex flex-row items-center mb-2`}> | ||
<Text style={tw`text-slate-300 text-lg`}> Found: </Text> | ||
<Text style={tw`text-xl text-white px-1`}> | ||
{props.foundWords} | ||
</Text> | ||
<Text style={tw`text-slate-200 text-lg`}> | ||
/{props.totalWords} | ||
</Text> | ||
</View> | ||
{props.word != "" ? ( | ||
<Text style={tw`text-lg bg-white px-2`}>{props.word}</Text> | ||
) : ( | ||
<View style={tw`h-7`}></View> | ||
)} | ||
</View> | ||
</View> | ||
); | ||
} | ||
|
||
export default ScoreDisplay; |
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.