From de4748706a8e3454c494d8f502d6acfaf9b83382 Mon Sep 17 00:00:00 2001 From: paresh Date: Tue, 19 Jan 2021 11:08:38 +1000 Subject: [PATCH 01/10] feature 1 --- src/components/Todos.tsx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/components/Todos.tsx b/src/components/Todos.tsx index 3eeba87..c609db6 100644 --- a/src/components/Todos.tsx +++ b/src/components/Todos.tsx @@ -19,6 +19,15 @@ const styles = StyleSheet.create({ export const Todos = () => { const defaultItems = sample.map((item, index) => ({ key: `item${index}`, ...item })); + console.log(defaultItems); + defaultItems.sort((item, item2)=>{ + if(item.points > item2.points) { + return 1; + } else if (item.points < item2.points){ + return -1; + } + return 0; + }) const [items, setItems] = useState(defaultItems); const addItem = (newItem: NewItem) => { From 5db2e2f3e2a62a6e5f97cac5e5bbf980983123ba Mon Sep 17 00:00:00 2001 From: paresh Date: Tue, 19 Jan 2021 11:15:18 +1000 Subject: [PATCH 02/10] feature 2 --- src/components/ItemCard.tsx | 6 +++++- src/components/Todos.tsx | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/components/ItemCard.tsx b/src/components/ItemCard.tsx index 8292d86..58e9195 100644 --- a/src/components/ItemCard.tsx +++ b/src/components/ItemCard.tsx @@ -19,6 +19,10 @@ const styles = StyleSheet.create({ }, textCritical: { fontWeight: 'bold', + }, + critical: { + backgroundColor: 'red', + color: 'yellow' } }); @@ -28,7 +32,7 @@ type Props = { } export const ItemCard: React.FC = ({ children, onDelete, critical }) => ( - + {children}