PluginProbe
Block Animations, Motion & Scroll Effects – Ghost Kit / 3.4.1
Block Animations, Motion & Scroll Effects – Ghost Kit v3.4.1
3.7.2 3.7.1 3.7.0 3.6.1 trunk 1.6.3 2.25.0 3.3.0 3.3.1 3.3.2 3.3.3 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.6 3.5.0 3.5.1 3.6.0
ghostkit / gutenberg / blocks / form / field-label / index.js

index.js in Block Animations, Motion & Scroll Effects – Ghost Kit 3.4.1, at gutenberg/blocks/form/field-label/index.js

36 lines 777 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import { RichText } from '@wordpress/block-editor';
2 import { __ } from '@wordpress/i18n';
3
4 /**
5 * Field Label Class.
6 *
7 * @param props
8 */
9 export default function FieldLabel(props) {
10 const { attributes, setAttributes, isSelected } = props;
11
12 const { label, hideLabel } = attributes;
13
14 if (!label && !isSelected) {
15 return null;
16 }
17
18 if (hideLabel && !isSelected) {
19 return null;
20 }
21
22 return (
23 // eslint-disable-next-line jsx-a11y/label-has-associated-control
24 <label className="ghostkit-form-field-label">
25 <RichText
26 inlineToolbar
27 tagName="span"
28 value={label}
29 placeholder={__('Write label…', 'ghostkit')}
30 onChange={(val) => setAttributes({ label: val })}
31 />
32 {attributes.required ? <span className="required">*</span> : ''}
33 </label>
34 );
35 }
36