Skip to content

Commit

Permalink
customfields: allow hidding section name
Browse files Browse the repository at this point in the history
  • Loading branch information
Javier Romero Caatro committed Jul 31, 2024
1 parent a3cdae1 commit a3ed259
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions src/lib/forms/widgets/custom_fields/CustomFields.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import PropTypes from "prop-types";
import { DiscoverFieldsSection } from "./DiscoverFieldsSection";
import { AccordionField } from "../../AccordionField";
import { loadWidgetsFromConfig } from "../loader";
import { Container } from "semantic-ui-react";

export class CustomFields extends Component {
constructor(props) {
Expand Down Expand Up @@ -77,16 +78,20 @@ export class CustomFields extends Component {
return (
<>
{sections &&
sections.map(({ fields, paths, ...sectionConfig }) => (
<AccordionField
key={sectionConfig.section}
includesPaths={paths}
label={sectionConfig.section}
active
>
{fields}
</AccordionField>
))}
sections.map(({ fields, paths, hideSection, ...sectionConfig }) =>
hideSection ? (
<Container key={sectionConfig.section}>{fields}</Container>
) : (
<AccordionField
key={sectionConfig.section}
includesPaths={paths}
label={sectionConfig.section}
active
>
{fields}
</AccordionField>
)
)}
{discoverFieldsSections && discoverFieldsSections.length > 0 && (
<DiscoverFieldsSection
templateLoaders={templateLoaders}
Expand Down

0 comments on commit a3ed259

Please sign in to comment.