Skip to content

Commit

Permalink
make h4 section headings optional
Browse files Browse the repository at this point in the history
  • Loading branch information
bobular committed Sep 9, 2023
1 parent 2e07f47 commit d33b1b4
Showing 1 changed file with 21 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,17 @@ export interface InputSpec {
* Can be used to override an input role's default title assigned in sectionInfo
* when we want the behavior/logic of an existing role but with a different
* title. Example: 2x2 mosaic's 'axis' variables.
* Note that the first input (of potentially many) found with this property sets the title.
* See also `noTitle` - because passing `null` to this doesn't get rid of the element.
*/
titleOverride?: ReactNode;
/**
* To have no title at all. Default false; Same one-to-many issues as titleOverride
*/
noTitle?: boolean;
/**
* apply custom styling to the input container
*/
styleOverride?: React.CSSProperties;
/**
* If an input is pre-populated and cannot be null, set this as true in order to prevent any
Expand Down Expand Up @@ -222,13 +231,18 @@ export function InputVariables(props: Props) {
className={classes.inputGroup}
style={{ order: sectionInfo[inputRole ?? 'default'].order }}
>
<div className={classes.fullRow}>
<h4>
{inputs.find(
(input) => input.role === inputRole && input.titleOverride
)?.titleOverride ?? sectionInfo[inputRole ?? 'default'].title}
</h4>
</div>
{!inputs.find(
(input) => input.role === inputRole && input.noTitle
) && (
<div className={classes.fullRow}>
<h4>
{inputs.find(
(input) => input.role === inputRole && input.titleOverride
)?.titleOverride ??
sectionInfo[inputRole ?? 'default'].title}
</h4>
</div>
)}
{inputs
.filter((input) => input.role === inputRole)
.map((input) => (
Expand Down

0 comments on commit d33b1b4

Please sign in to comment.