PluginProbe
Elementor Website Builder – more than just a page builder / 3.8.0-beta1
Elementor Website Builder – more than just a page builder v3.8.0-beta1
4.3.4 4.3.3 4.3.2 4.3.1 4.3.0 4.3.0-beta3 4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 All 457 releases
elementor / app / assets / js / ui / atoms / heading.js

heading.js in Elementor Website Builder – more than just a page builder 3.8.0-beta1, at app/assets/js/ui/atoms/heading.js

35 lines 838 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import { arrayToClassName } from '../../utils/utils';
2
3 export default function Heading( props ) {
4 const baseClassName = 'eps',
5 classes = [
6 props.className,
7 ];
8
9 if ( props.variant ) {
10 classes.push( baseClassName + '-' + props.variant );
11 }
12
13 const Element = () => React.createElement( props.tag, {
14 className: arrayToClassName( classes ),
15 }, props.children );
16
17 return <Element />;
18 }
19
20 Heading.propTypes = {
21 className: PropTypes.string,
22 children: PropTypes.oneOfType( [
23 PropTypes.string,
24 PropTypes.object,
25 PropTypes.arrayOf( PropTypes.object ),
26 ] ).isRequired,
27 tag: PropTypes.oneOf( [ 'h1', 'h2', 'h3', 'h4', 'h5', 'h6' ] ),
28 variant: PropTypes.oneOf( [ 'display-1', 'display-2', 'display-3', 'display-4', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6' ] ).isRequired,
29 };
30
31 Heading.defaultProps = {
32 className: '',
33 tag: 'h1',
34 };
35