Skip to content

Fix: Required not being handled on yes/no field #1165

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

Merged
merged 3 commits into from
Jun 10, 2022
Merged
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
49 changes: 24 additions & 25 deletions src/apps/content-editor/src/app/components/Editor/Field/Field.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { fetchItem, fetchItems, searchItems } from "shell/store/content";
import Stack from "@mui/material/Stack";
import ToggleButtonGroup from "@mui/material/ToggleButtonGroup";
import ToggleButton from "@mui/material/ToggleButton";
import FormControl from "@mui/material/FormControl";
import FormLabel from "@mui/material/FormLabel";
import Tooltip from "@mui/material/Tooltip";
import Box from "@mui/material/Box";
Expand Down Expand Up @@ -412,30 +413,28 @@ export default function Field({
if (settings.options) {
const binaryFieldOpts = Object.values(settings.options);
return (
<>
<FormLabel sx={{ color: "primary.dark" }}>
<Stack
direction="row"
alignItems="center"
sx={{
mb: 1,
}}
>
{settings.tooltip ? (
<Tooltip
placement="top-start"
arrow
title={settings.tooltip ? settings.tooltip : " "}
>
<InfoIcon fontSize="small" sx={{ mr: 1 }} />
</Tooltip>
) : (
" "
)}

{FieldTypeLabel}
</Stack>
</FormLabel>
<FormControl required={required}>
<Stack
direction="row"
alignItems="center"
spacing={1}
sx={{
mb: 1,
}}
>
{settings.tooltip ? (
<Tooltip
placement="top-start"
arrow
title={settings.tooltip ? settings.tooltip : " "}
>
<InfoIcon fontSize="small" />
</Tooltip>
) : (
" "
)}
<FormLabel>{FieldTypeLabel}</FormLabel>
</Stack>
<ToggleButtonGroup
color="secondary"
size="small"
Expand All @@ -453,7 +452,7 @@ export default function Field({
<Box component="p" sx={{ mt: 1 }}>
{description}
</Box>
</>
</FormControl>
);
} else {
return (
Expand Down