Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | 1x 1x 1x 1x 1x 1x 2x 2x | import React, { useRef } from 'react';
//AlertDependencies
import { Container, Box } from '@zohodesk/components/lib/Layout';
import AlertClose from '../../AlertClose/AlertClose';
import AlertIcons from '../../alertIcons/AlertIcons';
//CSS
import style from './css/AlertHeaderNew.module.css';
import cssJSLogic from './css/cssJSLogic';
import { mergeStyle } from '@zohodesk/utils';
//customHooks
import useDragger from '../../../Hooks/Dragger/useDragger';
//Props
import defaultProps from './props/defaultProps';
import propTypes from './props/propTypes';
export default function AlertHeader(props) {
const { title, needIcon, onClose, closeTitle, children, breakChildren, dataId, type, htmlId, customStyle, dragBoundaryLimit } = props;
const finalStyle = mergeStyle(style, customStyle);
const { alertHeaderContainerClass } = cssJSLogic({
props,
style: finalStyle
});
const dragRef = useRef(null); //dragRef
useDragger({ isActive: true, ChildRef: dragRef, boundaryLimit: dragBoundaryLimit }); //custom Hook
return (
<Container
align='vertical'
alignBox='row'
className={`${alertHeaderContainerClass}`}
isCover={false}
wrap='wrap'
data-drag-hook='true'
eleRef={dragRef}
>
{needIcon && (
<div className={finalStyle.iconContainer}>
<AlertIcons type={type} />
</div>
)}
{(title || children) && (
<Box flexible>
<Container alignBox='row' wrap={breakChildren ? 'wrap' : null}>
{title && (
<Box className={finalStyle.title} shrink id={htmlId}>
{title}
</Box>
)}
{children && (
<Box adjust flexible>
{children}
</Box>
)}
</Container>
</Box>
)}
{onClose && (
<Box className={style.close}>
<AlertClose onClose={onClose} dataTitle={closeTitle} dataId={`${dataId}_close`} type='light' />
</Box>
)}
</Container>
);
}
//Props
AlertHeader.propTypes = propTypes;
AlertHeader.defaultProps = defaultProps;
|