From 0befbf1105a94acda80162d9dfc464867341bfdd Mon Sep 17 00:00:00 2001 From: readme-bot Date: Fri, 28 Jul 2023 13:58:30 +0800 Subject: [PATCH 1/2] feat: add emoji before total value --- src/components/total-value/index.tsx | 30 ++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/src/components/total-value/index.tsx b/src/components/total-value/index.tsx index 1837969..c31c0c4 100644 --- a/src/components/total-value/index.tsx +++ b/src/components/total-value/index.tsx @@ -3,6 +3,12 @@ import { currencyWrapper } from "../../utils/currency"; import { useWindowSize } from "../../utils/hook"; import "./index.css"; +const emojiMap = { + up: "😄", + down: "😢", + else: "😑", +}; + const App = ({ data, currency, @@ -47,6 +53,13 @@ const App = ({ return `${size}vw`; } + function changePercentageEmoji() { + if (data.changePercentage === 0) { + return emojiMap["else"]; + } + return data.changePercentage > 0 ? emojiMap["up"] : emojiMap["down"]; + } + function changePercentageColorClass() { if (data.changePercentage === 0) { return ""; @@ -54,6 +67,13 @@ const App = ({ return data.changePercentage > 0 ? "positive" : "negative"; } + function totalValueStyle() { + return { + fontSize: totalValueFontSize(), + lineHeight: totalValueFontSize(), + }; + } + return (
+ {changePercentageEmoji()} + + {formatTotalValue()} From 1b50e809c96a51c3952fc2baa4dc5315bfdb6c20 Mon Sep 17 00:00:00 2001 From: readme-bot Date: Fri, 28 Jul 2023 13:59:48 +0800 Subject: [PATCH 2/2] reduce delay --- src/components/index/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/index/index.tsx b/src/components/index/index.tsx index 93f464c..5a1f15c 100644 --- a/src/components/index/index.tsx +++ b/src/components/index/index.tsx @@ -173,7 +173,7 @@ const App = () => { // set a loading delay to show the loading animation setTimeout(() => { loadAllDataAsync(size).finally(() => setLoading(false)); - }, 200); + }, 100); } function onMenuClicked() {