Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Task: Added generic icon for old field types #1706

Merged
merged 2 commits into from
Jan 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions src/apps/schema/src/appRevamp/components/Field/FieldIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,17 +123,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 (
<Box
Expand Down
3 changes: 3 additions & 0 deletions src/apps/schema/src/appRevamp/components/Field/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ const typeText: { [key: string]: string } = {
date: "Date",
datetime: "Date and Time",
dropdown: "Dropdown",
files: "Files",
font_awesome: "Font Awesome",
images: "Media",
internal_link: "Internal Link",
link: "External URL",
Expand All @@ -26,6 +28,7 @@ const typeText: { [key: string]: string } = {
text: "Single Line Text",
textarea: "Multi Line Text",
uuid: "UUID",
wysiwyg_advanced: "WYSYWYG (Advanced)",
wysiwyg_basic: "WYSIWYG",
yes_no: "Toggle",
};
Expand Down