components.widgets.Form.fieldsets.FieldsetHeader.tsx Maven / Gradle / Ivy
The newest version!
import classNames from 'classnames'
import React, { useContext } from 'react'
import { Props as BadgeProps } from '@i-novus/n2o-components/lib/display/Badge/Badge'
import HelpPopover from '../fields/StandardField/HelpPopover'
import Label from '../fields/StandardField/Label'
import { FactoryLevels } from '../../../../core/factory/factoryLevels'
import { FactoryContext } from '../../../../core/factory/context'
interface Props {
visible: boolean
badge?: BadgeProps
needLabel: boolean
needDescription: boolean
description: string
label: string
help?: string
}
export function FieldsetHeader({
visible,
badge,
label,
needLabel,
description,
needDescription,
help,
}: Props) {
const { getComponent } = useContext(FactoryContext)
if (!visible) { return null }
const FactoryBadge = getComponent('Badge', FactoryLevels.SNIPPETS)
return (
{FactoryBadge && (
)}
)
}