components.widgets.Form.fields.ButtonField.ButtonField.tsx Maven / Gradle / Ivy
The newest version!
import React, { CSSProperties, ReactNode } from 'react'
import classNames from 'classnames'
// @ts-ignore import from js file
import StandardButton from '../../../../buttons/StandardButton/StandardButton'
import { FieldAlignmentBlock } from '../FieldAlignmentBlock'
interface Props {
className?: string
style?: CSSProperties
visible: boolean
noLabelBlock?: boolean
children: ReactNode
labelPosition?: 'top' | 'top-right' | 'top-left' | 'bottom'
}
export function ButtonField({ className, style, noLabelBlock, children, visible = true, ...rest }: Props) {
if (!visible) { return null }
const { labelPosition } = rest
const isTopLabelPosition = labelPosition === 'top' || labelPosition === 'top-right' || labelPosition === 'top-left'
const isTopAlign = !noLabelBlock && isTopLabelPosition
return (
<>
{children || }
>
)
}
export default ButtonField