2020-07-02 22:53:38 +02:00
|
|
|
import React from 'react';
|
|
|
|
|
import classNames from 'classnames';
|
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
|
|
2023-06-07 15:05:35 +02:00
|
|
|
import Typography from '../Typography';
|
|
|
|
|
import Icon from '../Icon';
|
2020-07-02 22:53:38 +02:00
|
|
|
|
|
|
|
|
const CloseButton = ({ onClick }) => {
|
|
|
|
|
return (
|
2020-08-19 21:27:34 +02:00
|
|
|
<Icon
|
|
|
|
|
data-cy="close-button"
|
|
|
|
|
onClick={onClick}
|
|
|
|
|
name="close"
|
2023-09-01 22:19:39 +02:00
|
|
|
className="text-primary-active cursor-pointer"
|
2020-08-19 21:27:34 +02:00
|
|
|
/>
|
2020-07-02 22:53:38 +02:00
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
CloseButton.propTypes = {
|
|
|
|
|
onClick: PropTypes.func,
|
|
|
|
|
};
|
|
|
|
|
|
2024-05-27 20:30:25 +02:00
|
|
|
const Header = ({ title, noCloseButton = false, 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)}>
|
2023-09-01 22:19:39 +02:00
|
|
|
<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,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default Header;
|