AdvancedFields.js
2 years ago
AttributeHelp.js
2 years ago
BlockAddPrevButton.js
2 years ago
BlockAdvancedValue.js
2 years ago
BlockClassName.js
2 years ago
BlockDefaultValue.js
2 years ago
BlockDescription.js
2 years ago
BlockLabel.js
2 years ago
BlockName.js
2 years ago
BlockPlaceholder.js
2 years ago
BlockPrevButtonLabel.js
2 years ago
BlockRequired.js
2 years ago
BlockVisibility.js
2 years ago
FieldControl.js
2 years ago
FieldSettingsWrapper.js
2 years ago
FieldWrapper.js
2 years ago
GeneralFields.js
2 years ago
SelectVariations.js
2 years ago
ToggleGroupVariations.js
2 years ago
ToolBarDefault.js
2 years ago
ToolBarFields.js
2 years ago
BlockDescription.js
35 lines
| 1 | import useBlockAttributes from '../hooks/useBlockAttributes'; |
| 2 | import useIsHasAttribute from '../../hooks/useIsHasAttribute'; |
| 3 | import AttributeHelp from './AttributeHelp'; |
| 4 | |
| 5 | const { |
| 6 | __, |
| 7 | } = wp.i18n; |
| 8 | const { |
| 9 | TextControl, |
| 10 | } = wp.components; |
| 11 | |
| 12 | function BlockDescription( { label, help } ) { |
| 13 | const [ |
| 14 | attributes, |
| 15 | setAttributes, |
| 16 | ] = useBlockAttributes(); |
| 17 | |
| 18 | if ( !useIsHasAttribute( 'desc' ) ) { |
| 19 | return null; |
| 20 | } |
| 21 | |
| 22 | return <> |
| 23 | <TextControl |
| 24 | label={ label ?? __( 'Field Description', 'jet-form-builder' ) } |
| 25 | value={ attributes.desc } |
| 26 | className="jet-fb m-unset" |
| 27 | onChange={ desc => setAttributes( { desc } ) } |
| 28 | /> |
| 29 | <AttributeHelp name="desc"> |
| 30 | { help ?? '' } |
| 31 | </AttributeHelp> |
| 32 | </>; |
| 33 | } |
| 34 | |
| 35 | export default BlockDescription; |