2023-04-23 22:24:53 +02:00
|
|
|
import PropTypes from 'prop-types';
|
2023-05-23 17:15:17 +02:00
|
|
|
|
2023-11-15 12:13:53 +01:00
|
|
|
import { Link } from 'react-router-dom';
|
|
|
|
|
2024-01-12 11:31:24 +01: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 22:24:53 +02:00
|
|
|
|
2023-11-15 12:13:53 +01:00
|
|
|
import { Icon } from 'mastodon/components/icon';
|
2023-06-23 16:34:27 +02:00
|
|
|
|
2023-11-15 12:13:53 +01:00
|
|
|
export const Step = ({ label, description, icon, iconComponent, completed, onClick, href, to }) => {
|
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>
|
|
|
|
);
|
2023-11-15 12:13:53 +01:00
|
|
|
} else if (to) {
|
|
|
|
return (
|
|
|
|
<Link to={to} className='onboarding__steps__item'>
|
|
|
|
{content}
|
|
|
|
</Link>
|
|
|
|
);
|
2023-04-23 22:24:53 +02: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 19:45:08 +02:00
|
|
|
iconComponent: PropTypes.func,
|
2023-04-23 22:24:53 +02:00
|
|
|
completed: PropTypes.bool,
|
|
|
|
href: PropTypes.string,
|
2023-11-15 12:13:53 +01:00
|
|
|
to: PropTypes.string,
|
2023-04-23 22:24:53 +02:00
|
|
|
onClick: PropTypes.func,
|
|
|
|
};
|