Skip to content

Commit

Permalink
Merge pull request #706
Browse files Browse the repository at this point in the history
* fix(28701): fix style of folder array items when error
  • Loading branch information
vanch3d authored Dec 16, 2024
1 parent 4d542c0 commit e726774
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ export const ArrayFieldItemTemplate: FC<ArrayFieldTemplateItemType> = (props) =>
if (props.children.props.idSchema.$id === expandItems.join('_')) onOpen()
}, [expandItems, onOpen, props.children.props.idSchema.$id])

const hasErrors = Boolean(props.children.props.errorSchema)
const errorStyle =
hasErrors && collapsableItems && !isOpen ? { borderColor: '#E53E3E', boxShadow: '0 0 0 1px #E53E3E' } : undefined

const onCopyClick = useMemo(() => onCopyIndexClick(index), [index, onCopyIndexClick])
const onRemoveClick = useMemo(() => onDropIndexClick(index), [index, onDropIndexClick])
const onArrowUpClick = useMemo(() => onReorderClick(index, index - 1), [index, onReorderClick])
Expand All @@ -65,7 +69,7 @@ export const ArrayFieldItemTemplate: FC<ArrayFieldTemplateItemType> = (props) =>
const renderCollapsed = () => {
const TitleFieldTemplate = getTemplate<'TitleFieldTemplate'>('TitleFieldTemplate', registry, uiOptions)
return (
<FormControl variant="hivemq">
<FormControl variant="hivemq" sx={errorStyle}>
<TitleFieldTemplate
title={name}
id={children.props.name}
Expand Down

0 comments on commit e726774

Please sign in to comment.