2020-07-02 22:53:38 +02:00
|
|
|
import React from 'react';
|
|
|
|
|
import classNames from 'classnames';
|
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
|
|
|
|
|
|
import { Typography, Icon } from '..';
|
|
|
|
|
|
|
|
|
|
const CloseButton = ({ onClick }) => {
|
|
|
|
|
return (
|
2020-08-19 21:27:34 +02:00
|
|
|
<Icon
|
|
|
|
|
data-cy="close-button"
|
|
|
|
|
onClick={onClick}
|
|
|
|
|
name="close"
|
2023-06-07 14:31:09 +02:00
|
|
|
className="cursor-pointer text-primary-active"
|
2020-08-19 21:27:34 +02:00
|
|
|
/>
|
2020-07-02 22:53:38 +02:00
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
CloseButton.propTypes = {
|
|
|
|
|
onClick: PropTypes.func,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const Header = ({ title, noCloseButton, onClose }) => {
|
2023-06-07 14:31:09 +02:00
|
|
|
const theme = 'bg-primary-dark';
|
2020-07-02 22:53:38 +02:00
|
|
|
const flex = 'flex items-center justify-between';
|
2023-06-07 14:31:09 +02:00
|
|
|
const padding = 'pb-[20px]';
|
2020-07-02 22:53:38 +02:00
|
|
|
|
|
|
|
|
return (
|
2023-06-07 14:31:09 +02:00
|
|
|
<div className={classNames(theme, flex, padding)}>
|
|
|
|
|
<Typography variant="h6" color="primaryLight" className="!leading-[1.2]">
|
2020-07-02 22:53:38 +02:00
|
|
|
{title}
|
|
|
|
|
</Typography>
|
|
|
|
|
{!noCloseButton && <CloseButton onClick={onClose} />}
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
Header.propTypes = {
|
|
|
|
|
className: PropTypes.string,
|
|
|
|
|
title: PropTypes.string,
|
|
|
|
|
noCloseButton: PropTypes.bool,
|
|
|
|
|
onClose: PropTypes.func,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
Header.defaultProps = {
|
2022-09-20 02:02:53 +02:00
|
|
|
noCloseButton: false,
|
2020-07-02 22:53:38 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default Header;
|