Skip to content

Commit

Permalink
feat: support className config for row, block and array fields (#504)
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgeyB authored Apr 5, 2022
1 parent 9e9aa64 commit 0461c21
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
8 changes: 7 additions & 1 deletion src/admin/components/forms/field-types/Array/Array.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const ArrayFieldType: React.FC<Props> = (props) => {
readOnly,
description,
condition,
className,
},
} = props;

Expand Down Expand Up @@ -121,10 +122,15 @@ const ArrayFieldType: React.FC<Props> = (props) => {

const hasMaxRows = maxRows && rows.length >= maxRows;

const classes = [
baseClass,
className,
].filter(Boolean).join(' ');

return (
<DragDropContext onDragEnd={onDragEnd}>
<div
className={baseClass}
className={classes}
>
<div className={`${baseClass}__error-wrap`}>
<Error
Expand Down
8 changes: 7 additions & 1 deletion src/admin/components/forms/field-types/Blocks/Blocks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ const Blocks: React.FC<Props> = (props) => {
readOnly,
description,
condition,
className,
},
} = props;

Expand Down Expand Up @@ -168,10 +169,15 @@ const Blocks: React.FC<Props> = (props) => {

const hasMaxRows = maxRows && rows.length >= maxRows;

const classes = [
baseClass,
className,
].filter(Boolean).join(' ');

return (
<DragDropContext onDragEnd={onDragEnd}>
<div
className={baseClass}
className={classes}
>
<div className={`${baseClass}__error-wrap`}>
<Error
Expand Down
9 changes: 8 additions & 1 deletion src/admin/components/forms/field-types/Row/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,20 @@ const Row: React.FC<Props> = (props) => {
permissions,
admin: {
readOnly,
className,
},
} = props;

const classes = [
'field-type',
'row',
className,
].filter(Boolean).join(' ');

return (
<RenderFields
readOnly={readOnly}
className="field-type row"
className={classes}
permissions={permissions?.fields}
fieldTypes={fieldTypes}
fieldSchema={fields.map((field) => ({
Expand Down

0 comments on commit 0461c21

Please sign in to comment.