2023-04-24 06:24:53 +10:00
|
|
|
import PropTypes from 'prop-types';
|
2023-05-24 01:15:17 +10:00
|
|
|
|
2023-11-15 22:13:53 +11:00
|
|
|
import { Link } from 'react-router-dom';
|
|
|
|
|
2024-01-16 21:27:26 +11:00
|
|
|
import ArrowRightAltIcon from '@/material-icons/400-24px/arrow_right_alt.svg?react';
|
|
|
|
import CheckIcon from '@/material-icons/400-24px/done.svg?react';
|
2023-11-15 22:13:53 +11:00
|
|
|
import { Icon } from 'mastodon/components/icon';
|
2023-06-24 00:34:27 +10:00
|
|
|
|
2023-11-15 22:13:53 +11:00
|
|
|
export const Step = ({ label, description, icon, iconComponent, completed, onClick, href, to }) => {
|
2023-04-24 06:24:53 +10:00
|
|
|
const content = (
|
|
|
|
<>
|
|
|
|
<div className='onboarding__steps__item__icon'>
|
2023-10-25 04:45:08 +11:00
|
|
|
<Icon id={icon} icon={iconComponent} />
|
2023-04-24 06:24:53 +10:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div className='onboarding__steps__item__description'>
|
|
|
|
<h6>{label}</h6>
|
|
|
|
<p>{description}</p>
|
|
|
|
</div>
|
|
|
|
|
2023-06-24 00:34:27 +10:00
|
|
|
<div className={completed ? 'onboarding__steps__item__progress' : 'onboarding__steps__item__go'}>
|
2023-10-25 04:45:08 +11:00
|
|
|
{completed ? <Icon icon={CheckIcon} /> : <Icon icon={ArrowRightAltIcon} />}
|
2023-06-24 00:34:27 +10:00
|
|
|
</div>
|
2023-04-24 06:24:53 +10:00
|
|
|
</>
|
|
|
|
);
|
|
|
|
|
|
|
|
if (href) {
|
|
|
|
return (
|
|
|
|
<a href={href} onClick={onClick} target='_blank' rel='noopener' className='onboarding__steps__item'>
|
|
|
|
{content}
|
|
|
|
</a>
|
|
|
|
);
|
2023-11-15 22:13:53 +11:00
|
|
|
} else if (to) {
|
|
|
|
return (
|
|
|
|
<Link to={to} className='onboarding__steps__item'>
|
|
|
|
{content}
|
|
|
|
</Link>
|
|
|
|
);
|
2023-04-24 06:24:53 +10: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 04:45:08 +11:00
|
|
|
iconComponent: PropTypes.func,
|
2023-04-24 06:24:53 +10:00
|
|
|
completed: PropTypes.bool,
|
|
|
|
href: PropTypes.string,
|
2023-11-15 22:13:53 +11:00
|
|
|
to: PropTypes.string,
|
2023-04-24 06:24:53 +10:00
|
|
|
onClick: PropTypes.func,
|
|
|
|
};
|