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 / molecules / notice.js

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

64 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import { arrayToClassName } from 'elementor-app/utils/utils.js';
2
3 import Text from 'elementor-app/ui/atoms/text';
4 import Icon from 'elementor-app/ui/atoms/icon';
5 import Grid from 'elementor-app/ui/grid/grid';
6
7 import './notice.scss';
8
9 const iconsClassesMap = {
10 danger: 'eicon-warning',
11 info: 'eicon-info-circle-o',
12 warning: 'eicon-warning',
13 };
14
15 export default function Notice( props ) {
16 const baseClassName = 'eps-notice',
17 classes = [ baseClassName, props.className ];
18
19 if ( props.color ) {
20 classes.push( baseClassName + '-semantic', baseClassName + '--' + props.color );
21 }
22
23 return (
24 <Grid className={ arrayToClassName( classes ) } container noWrap alignItems="center" justify="space-between">
25 <Grid item container alignItems="start" noWrap>
26 {
27 props.withIcon &&
28 props.color &&
29 <Icon className={ arrayToClassName( [ 'eps-notice__icon', iconsClassesMap[ props.color ] ] ) } />
30 }
31
32 <Text variant="xs" className="eps-notice__text">
33 { props.label && <strong>{ props.label + ' ' }</strong> }
34
35 { props.children }
36 </Text>
37 </Grid>
38
39 {
40 props.button &&
41 <Grid item container justify="end" className={ baseClassName + '__button-container' }>
42 { props.button }
43 </Grid>
44 }
45 </Grid>
46 );
47 }
48
49 Notice.propTypes = {
50 className: PropTypes.string,
51 color: PropTypes.string,
52 label: PropTypes.string,
53 children: PropTypes.any.isRequired,
54 icon: PropTypes.string,
55 withIcon: PropTypes.bool,
56 button: PropTypes.object,
57 };
58
59 Notice.defaultProps = {
60 className: '',
61 withIcon: true,
62 button: null,
63 };
64