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