diff --git a/README.md b/README.md index 40f3524..cbb538d 100644 --- a/README.md +++ b/README.md @@ -43,3 +43,5 @@ Our users are keen to be able to add point values to tasks with a natural langua ## Feature Four If you've got some extra time left, it would be great for our users to be able to update the point value of an existing task. Implement the UI however you think best. + +Thank you diff --git a/src/components/CreateEntry.tsx b/src/components/CreateEntry.tsx index 0f7cfc7..c1a49a4 100644 --- a/src/components/CreateEntry.tsx +++ b/src/components/CreateEntry.tsx @@ -28,7 +28,17 @@ export const CreateEntry = ({ onSave }: Props) => { const [value, setValue] = useState(''); const handleAdd = () => { - value && onSave({ name: value, points: 0 }); + let actualPoint: number = 0; + let points = value.substr(-5); + let name: string = value.substr(0, value.length-5); + let actualPointString: string = points.substr(0, 2); + if (isNaN(parseInt(actualPointString))) { + actualPoint = 0; + name = value; + } else { + actualPoint = parseInt(actualPointString.trim()); + } + value && onSave({ name: name.trim(), points: actualPoint }); setValue(''); } diff --git a/src/components/ItemCard.tsx b/src/components/ItemCard.tsx index 8292d86..1aa6534 100644 --- a/src/components/ItemCard.tsx +++ b/src/components/ItemCard.tsx @@ -10,6 +10,7 @@ const styles = StyleSheet.create({ paddingHorizontal: 16, marginTop: 2, backgroundColor: 'white', + fontWeight: 'bold' }, containerCritical: { backgroundColor: '#ffdddd', @@ -19,6 +20,11 @@ const styles = StyleSheet.create({ }, textCritical: { fontWeight: 'bold', + }, + critical: { + backgroundColor: 'red', + color: 'yellow', + fontWeight: 'bold' } }); @@ -28,7 +34,7 @@ type Props = { } export const ItemCard: React.FC = ({ children, onDelete, critical }) => ( - + {children}