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