From 125eaf49a9bafd4d31033c9924c4d2091914a171 Mon Sep 17 00:00:00 2001 From: ascarbek Date: Tue, 11 Apr 2023 22:10:28 +0600 Subject: [PATCH] refactor: color item --- .../_shared/EditRow/EditCellOptionPopup.tsx | 191 +++++++----------- 1 file changed, 74 insertions(+), 117 deletions(-) diff --git a/frontend/appflowy_tauri/src/appflowy_app/components/_shared/EditRow/EditCellOptionPopup.tsx b/frontend/appflowy_tauri/src/appflowy_app/components/_shared/EditRow/EditCellOptionPopup.tsx index b7a7e9f0e6..62f809cf80 100644 --- a/frontend/appflowy_tauri/src/appflowy_app/components/_shared/EditRow/EditCellOptionPopup.tsx +++ b/frontend/appflowy_tauri/src/appflowy_app/components/_shared/EditRow/EditCellOptionPopup.tsx @@ -105,134 +105,91 @@ export const EditCellOptionPopup = ({
{t('grid.selectOption.colorPanelTitle')}
-
onColorClick(SelectOptionColorPB.Purple)} - > -
-
- {t('grid.selectOption.purpleColor')} -
- {editingSelectOption.color === SelectOptionColorPB.Purple && ( - - - - )} -
-
+ onColorClick(SelectOptionColorPB.Pink)} - > -
-
- {t('grid.selectOption.pinkColor')} -
- {editingSelectOption.color === SelectOptionColorPB.Pink && ( - - - - )} -
-
+ onColorClick(SelectOptionColorPB.LightPink)} - > -
-
- {t('grid.selectOption.lightPinkColor')} -
- {editingSelectOption.color === SelectOptionColorPB.LightPink && ( - - - - )} -
-
+ onColorClick(SelectOptionColorPB.Orange)} - > -
-
- {t('grid.selectOption.orangeColor')} -
- {editingSelectOption.color === SelectOptionColorPB.Orange && ( - - - - )} -
-
+ onColorClick(SelectOptionColorPB.Yellow)} - > -
-
- {t('grid.selectOption.yellowColor')} -
- {editingSelectOption.color === SelectOptionColorPB.Yellow && ( - - - - )} -
-
+ onColorClick(SelectOptionColorPB.Lime)} - > -
-
- {t('grid.selectOption.limeColor')} -
- {editingSelectOption.color === SelectOptionColorPB.Lime && ( - - - - )} -
-
+ onColorClick(SelectOptionColorPB.Green)} - > -
-
- {t('grid.selectOption.greenColor')} -
- {editingSelectOption.color === SelectOptionColorPB.Green && ( - - - - )} -
-
+ onColorClick(SelectOptionColorPB.Aqua)} - > -
-
- {t('grid.selectOption.aquaColor')} -
- {editingSelectOption.color === SelectOptionColorPB.Aqua && ( - - - - )} -
-
+ onColorClick(SelectOptionColorPB.Blue)} - > -
-
- {t('grid.selectOption.blueColor')} -
- {editingSelectOption.color === SelectOptionColorPB.Blue && ( - - - - )} -
+ bgColor={getBgColor(SelectOptionColorPB.Blue)} + checked={editingSelectOption.color === SelectOptionColorPB.Blue} + >
); }; + +const ColorItem = ({ + title, + bgColor, + onClick, + checked, +}: { + title: string; + bgColor: string; + onClick: () => void; + checked: boolean; +}) => { + return ( +
onClick()} + > +
+
+ {title} +
+ {checked && ( + + + + )} +
+ ); +};