From 4dada963c58df58df7cc6ca2c745d542d6d1258e Mon Sep 17 00:00:00 2001 From: Nar Cuenca Date: Mon, 9 Jan 2023 10:27:42 +0800 Subject: [PATCH 1/2] task: added generic icon for old field types --- .../appRevamp/components/Field/FieldIcon.tsx | 17 ++++++++++++----- .../src/appRevamp/components/Field/index.tsx | 3 +++ 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/apps/schema/src/appRevamp/components/Field/FieldIcon.tsx b/src/apps/schema/src/appRevamp/components/Field/FieldIcon.tsx index 1bec86bc0f..e8e8fb5dc9 100644 --- a/src/apps/schema/src/appRevamp/components/Field/FieldIcon.tsx +++ b/src/apps/schema/src/appRevamp/components/Field/FieldIcon.tsx @@ -16,6 +16,7 @@ import ToggleOnRounded from "@mui/icons-material/ToggleOnRounded"; import KeyboardArrowDownRounded from "@mui/icons-material/KeyboardArrowDownRounded"; import ColorLensRounded from "@mui/icons-material/ColorLensRounded"; import FormatListNumberedRounded from "@mui/icons-material/FormatListNumberedRounded"; +import ListAltRoundedIcon from "@mui/icons-material/ListAltRounded"; import { Markdown, OneToOne, EditNote } from "@zesty-io/material"; import { Box } from "@mui/system"; import { SvgIcon } from "@mui/material"; @@ -123,17 +124,23 @@ const icons: Icons = { backgroundColor: "purple.50", borderColor: "purple.700", }, + generic: { + icon: AttachmentRounded, + backgroundColor: "grey.100", + borderColor: "grey.700", + }, }; interface Props { type: string; } export const FieldIcon = ({ type }: Props) => { - const icon = icons[type].icon; - const borderColor = icons[type].borderColor; - const bgcolor = icons[type].backgroundColor; - const transform = - type === "files" || type === "images" ? "rotate(-45deg)" : ""; + const icon = icons[type]?.icon || icons["generic"].icon; + const borderColor = icons[type]?.borderColor || icons["generic"].borderColor; + const bgcolor = + icons[type]?.backgroundColor || icons["generic"].backgroundColor; + // Since we're using the paper clip icon for generic types we also rotate the icon + const transform = type === "images" || !icons[type] ? "rotate(-45deg)" : ""; return ( Date: Mon, 9 Jan 2023 10:29:30 +0800 Subject: [PATCH 2/2] task: removed unused icon --- src/apps/schema/src/appRevamp/components/Field/FieldIcon.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/apps/schema/src/appRevamp/components/Field/FieldIcon.tsx b/src/apps/schema/src/appRevamp/components/Field/FieldIcon.tsx index e8e8fb5dc9..d82e201af4 100644 --- a/src/apps/schema/src/appRevamp/components/Field/FieldIcon.tsx +++ b/src/apps/schema/src/appRevamp/components/Field/FieldIcon.tsx @@ -16,7 +16,6 @@ import ToggleOnRounded from "@mui/icons-material/ToggleOnRounded"; import KeyboardArrowDownRounded from "@mui/icons-material/KeyboardArrowDownRounded"; import ColorLensRounded from "@mui/icons-material/ColorLensRounded"; import FormatListNumberedRounded from "@mui/icons-material/FormatListNumberedRounded"; -import ListAltRoundedIcon from "@mui/icons-material/ListAltRounded"; import { Markdown, OneToOne, EditNote } from "@zesty-io/material"; import { Box } from "@mui/system"; import { SvgIcon } from "@mui/material";