Skip to content

Commit

Permalink
Task: Schema field items (#1695)
Browse files Browse the repository at this point in the history
* task: add icons

* task: updated field style

* task: updated field icons

* task: updated icon list & show/hide drag icon

* task: moved field to it's own folder & added field icon component

* task: removed unused files

* task: added copy zuid button

* task: added copy zuid functionality

* task: updated field styles and added roboto mono font

* task: removed unused css
  • Loading branch information
finnar-bin authored Jan 8, 2023
1 parent 89901bc commit 00b2383
Show file tree
Hide file tree
Showing 6 changed files with 341 additions and 72 deletions.
5 changes: 5 additions & 0 deletions public/offline.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@
href="https://fonts.googleapis.com/css?family=Mulish"
/>

<link
rel="stylesheet"
href="https://fonts.googleapis.com/css?family=Roboto+Mono"
/>

<style type="text/css">
* {
margin: 0;
Expand Down
72 changes: 0 additions & 72 deletions src/apps/schema/src/appRevamp/components/Field.tsx

This file was deleted.

163 changes: 163 additions & 0 deletions src/apps/schema/src/appRevamp/components/Field/FieldIcon.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
import { SvgIconComponent } from "@mui/icons-material";
import PublicRoundedIcon from "@mui/icons-material/PublicRounded";
import TitleRounded from "@mui/icons-material/TitleRounded";
import SubjectRounded from "@mui/icons-material/SubjectRounded";
import NewspaperRounded from "@mui/icons-material/NewspaperRounded";
import LinkRounded from "@mui/icons-material/LinkRounded";
import DocumentScannerRounded from "@mui/icons-material/DocumentScannerRounded";
import AccountTreeRounded from "@mui/icons-material/AccountTreeRounded";
import AttachmentRounded from "@mui/icons-material/AttachmentRounded";
import PaymentsRounded from "@mui/icons-material/PaymentsRounded";
import CalendarTodayRounded from "@mui/icons-material/CalendarTodayRounded";
import ScheduleRounded from "@mui/icons-material/ScheduleRounded";
import PinRounded from "@mui/icons-material/PinRounded";
import TagRounded from "@mui/icons-material/TagRounded";
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 { Markdown, OneToOne, EditNote } from "@zesty-io/material";
import { Box } from "@mui/system";
import { SvgIcon } from "@mui/material";

type Icons = {
[key: string]: {
icon: SvgIconComponent;
backgroundColor: string;
borderColor: string;
};
};
const icons: Icons = {
article_writer: {
icon: EditNote as SvgIconComponent,
backgroundColor: "green.50",
borderColor: "green.500",
},
color: {
icon: ColorLensRounded,
backgroundColor: "purple.50",
borderColor: "purple.700",
},
currency: {
icon: PaymentsRounded,
backgroundColor: "purple.50",
borderColor: "purple.700",
},
date: {
icon: CalendarTodayRounded,
backgroundColor: "deepOrange.50",
borderColor: "deepOrange.500",
},
datetime: {
icon: ScheduleRounded,
backgroundColor: "deepOrange.50",
borderColor: "deepOrange.500",
},
dropdown: {
icon: KeyboardArrowDownRounded,
backgroundColor: "purple.50",
borderColor: "purple.700",
},
images: {
icon: AttachmentRounded,
backgroundColor: "blue.50",
borderColor: "blue.500",
},
internal_link: {
icon: DocumentScannerRounded,
backgroundColor: "pink.50",
borderColor: "pink.600",
},
link: {
icon: LinkRounded,
backgroundColor: "pink.50",
borderColor: "pink.600",
},
markdown: {
icon: Markdown as SvgIconComponent,
backgroundColor: "green.50",
borderColor: "green.500",
},
number: {
icon: PinRounded,
backgroundColor: "red.50",
borderColor: "red.600",
},
one_to_many: {
icon: AccountTreeRounded,
backgroundColor: "pink.50",
borderColor: "pink.600",
},
one_to_one: {
icon: OneToOne as SvgIconComponent,
backgroundColor: "pink.50",
borderColor: "pink.600",
},
sort: {
icon: FormatListNumberedRounded,
backgroundColor: "purple.50",
borderColor: "purple.700",
},
text: {
icon: TitleRounded,
backgroundColor: "green.50",
borderColor: "green.600",
},
textarea: {
icon: SubjectRounded,
backgroundColor: "green.50",
borderColor: "green.600",
},
uuid: {
icon: TagRounded,
backgroundColor: "red.50",
borderColor: "red.600",
},
wysiwyg_basic: {
icon: NewspaperRounded,
backgroundColor: "green.50",
borderColor: "green.500",
},
yes_no: {
icon: ToggleOnRounded,
backgroundColor: "purple.50",
borderColor: "purple.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)" : "";

return (
<Box
border="1px solid red"
borderColor={borderColor}
borderRadius={1}
bgcolor={bgcolor}
color={borderColor}
width="24px"
height="24px"
fontSize="12px"
display="flex"
alignItems="center"
justifyContent="center"
>
<SvgIcon
component={icon}
fontSize="inherit"
sx={{
verticalAlign: "middle",
transform,
textAlign: "center",
}}
/>
</Box>
);
};
Loading

0 comments on commit 00b2383

Please sign in to comment.