2023-04-23 22:24:53 +02:00
|
|
|
import PropTypes from 'prop-types';
|
2023-12-02 19:21:43 +01:00
|
|
|
|
2023-10-24 19:45:08 +02:00
|
|
|
import { ReactComponent as ArrowRightAltIcon } from '@material-symbols/svg-600/outlined/arrow_right_alt.svg';
|
|
|
|
import { ReactComponent as CheckIcon } from '@material-symbols/svg-600/outlined/done.svg';
|
2023-04-23 22:24:53 +02:00
|
|
|
|
2023-10-24 19:45:08 +02:00
|
|
|
import { Icon } from 'flavours/glitch/components/icon';
|
2023-06-23 16:34:27 +02:00
|
|
|
|
2023-10-24 19:45:08 +02:00
|
|
|
const Step = ({ label, description, icon, iconComponent, completed, onClick, href }) => {
|
2023-04-23 22:24:53 +02:00
|
|
|
const content = (
|
|
|
|
<>
|
|
|
|
<div className='onboarding__steps__item__icon'>
|
2023-10-24 19:45:08 +02:00
|
|
|
<Icon id={icon} icon={iconComponent} />
|
2023-04-23 22:24:53 +02:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div className='onboarding__steps__item__description'>
|
|
|
|
<h6>{label}</h6>
|
|
|
|
<p>{description}</p>
|
|
|
|
</div>
|
|
|
|
|
2023-06-23 16:34:27 +02:00
|
|
|
<div className={completed ? 'onboarding__steps__item__progress' : 'onboarding__steps__item__go'}>
|
2023-10-24 19:45:08 +02:00
|
|
|
{completed ? <Icon icon={CheckIcon} /> : <Icon icon={ArrowRightAltIcon} />}
|
2023-06-23 16:34:27 +02:00
|
|
|
</div>
|
2023-04-23 22:24:53 +02:00
|
|
|
</>
|
|
|
|
);
|
|
|
|
|
|
|
|
if (href) {
|
|
|
|
return (
|
|
|
|
<a href={href} onClick={onClick} target='_blank' rel='noopener' className='onboarding__steps__item'>
|
|
|
|
{content}
|
|
|
|
</a>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
|
|
<button onClick={onClick} className='onboarding__steps__item'>
|
|
|
|
{content}
|
|
|
|
</button>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
Step.propTypes = {
|
|
|
|
label: PropTypes.node,
|
|
|
|
description: PropTypes.node,
|
|
|
|
icon: PropTypes.string,
|
2023-10-24 19:45:08 +02:00
|
|
|
iconComponent: PropTypes.func,
|
2023-04-23 22:24:53 +02:00
|
|
|
completed: PropTypes.bool,
|
|
|
|
href: PropTypes.string,
|
|
|
|
onClick: PropTypes.func,
|
|
|
|
};
|
|
|
|
|
2023-05-09 03:11:56 +02:00
|
|
|
export default Step;
|