-
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.
- Loading branch information
1 parent
986a244
commit e90515d
Showing
6 changed files
with
54 additions
and
35 deletions.
There are no files selected for viewing
30 changes: 21 additions & 9 deletions
30
components/available-values-item/available-values-item.styles.ts
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
30 changes: 15 additions & 15 deletions
30
components/available-values-item/available-values-item.tsx
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 |
---|---|---|
@@ -1,30 +1,30 @@ | ||
import { cs } from '@rnw-community/shared'; | ||
import { Pressable, Text } from 'react-native'; | ||
|
||
import { useAppDispatch } from '../../hooks/redux.hook'; | ||
import { appRootSelectValueAction } from '../../store/app-root/actions/app-root-select-value.action'; | ||
import { cs, type OnEventFn } from '@rnw-community/shared'; | ||
import { Pressable, Text, View } from 'react-native'; | ||
|
||
import { AvailableValuesItemStyles as styles } from './available-values-item.styles'; | ||
|
||
interface Props { | ||
value: number; | ||
isActive: boolean; | ||
progress: number; | ||
onSelect: OnEventFn<number>; | ||
} | ||
|
||
// TODO: Add animation when wrong value is selected | ||
// TODO: Add animation when correct value is selected | ||
export const AvailableValuesItem = ({ value }: Props) => { | ||
const dispatch = useAppDispatch(); | ||
|
||
const isActive = false; | ||
|
||
const handlePress = () => void dispatch(appRootSelectValueAction(value)); | ||
export const AvailableValuesItem = ({ value, isActive, onSelect, progress }: Props) => { | ||
const handlePress = () => onSelect(value); | ||
|
||
const wrapperStyles = [styles.wrapper, cs(isActive, styles.wrapperActive)]; | ||
const buttonStyles = [styles.button, cs(isActive, styles.wrapperActive)]; | ||
const textStyles = [styles.text, cs(isActive, styles.textActive)]; | ||
const progressStyles = [styles.progress, { width: `${progress}%` }]; | ||
|
||
return ( | ||
<Pressable key={value} style={wrapperStyles} onPress={handlePress}> | ||
<Text style={textStyles}>{value}</Text> | ||
</Pressable> | ||
<View style={styles.container}> | ||
<Pressable key={value} style={buttonStyles} onPress={handlePress}> | ||
<Text style={textStyles}>{value}</Text> | ||
</Pressable> | ||
<View style={progressStyles} /> | ||
</View> | ||
); | ||
}; |
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 |
---|---|---|
@@ -1,17 +1,11 @@ | ||
import { StyleSheet } from 'react-native'; | ||
|
||
import { CellSizeConstant } from '../../constants/dimensions.contant'; | ||
|
||
export const AvailableValuesStyles = StyleSheet.create({ | ||
valueWrapper: { | ||
borderWidth: 1, | ||
height: CellSizeConstant, | ||
width: CellSizeConstant | ||
}, | ||
wrapper: { | ||
flex: 1, | ||
flexDirection: 'row', | ||
gap: 2, | ||
flexWrap: 'wrap', | ||
gap: 10, | ||
justifyContent: 'center' | ||
} | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export const CellSizeConstant = 50; | ||
export const CellSizeConstant = 45; |