From 94717de32ff5373d93ee3f8ca427ce7da42e33a8 Mon Sep 17 00:00:00 2001 From: Cabbache Date: Sat, 20 Jan 2024 13:44:59 +0100 Subject: [PATCH] add color property as suggested by buonan --- README.md | 2 ++ src/components/utils.js | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 02cdd96..f1b0d3e 100644 --- a/README.md +++ b/README.md @@ -175,6 +175,7 @@ Type: Object - startTime: Date (result of [`genTimeBlock`](#genTimeBlock)) - endTime: Date (result of [`genTimeBlock`](#genTimeBlock)) - location: String + - color: String - extra_descriptions: Array Of String e.g.) @@ -185,6 +186,7 @@ e.g.) startTime: Date, // I surely recommend to make Date using genTimeBlock function endTime: Date, location: String, + color: String extra_descriptions: Array Of String, } ``` diff --git a/src/components/utils.js b/src/components/utils.js index dd436f9..b986e31 100644 --- a/src/components/utils.js +++ b/src/components/utils.js @@ -60,7 +60,7 @@ const assignColor = (events) => { }, []).length; acc.push({ ...item, - color: sameOne === undefined ? pickColor(count) : sameOne.color, + color: item.color ? item.color : sameOne === undefined ? pickColor(count) : sameOne.color, id: idx, }); return acc;