2023-04-24 06:24:53 +10:00
|
|
|
import PropTypes from 'prop-types';
|
2023-05-24 01:15:17 +10:00
|
|
|
import { Fragment } from 'react';
|
|
|
|
|
2023-04-24 06:24:53 +10:00
|
|
|
import classNames from 'classnames';
|
|
|
|
|
2023-10-25 04:45:08 +11:00
|
|
|
import { ReactComponent as CheckIcon } from '@material-symbols/svg-600/outlined/done.svg';
|
|
|
|
|
|
|
|
import { Icon } from 'mastodon/components/icon';
|
2023-05-24 01:15:17 +10:00
|
|
|
|
2023-04-24 06:24:53 +10:00
|
|
|
const ProgressIndicator = ({ steps, completed }) => (
|
|
|
|
<div className='onboarding__progress-indicator'>
|
|
|
|
{(new Array(steps)).fill().map((_, i) => (
|
2023-05-23 18:52:27 +10:00
|
|
|
<Fragment key={i}>
|
2023-04-24 06:24:53 +10:00
|
|
|
{i > 0 && <div className={classNames('onboarding__progress-indicator__line', { active: completed > i })} />}
|
|
|
|
|
|
|
|
<div className={classNames('onboarding__progress-indicator__step', { active: completed > i })}>
|
2023-10-25 04:45:08 +11:00
|
|
|
{completed > i && <Icon icon={CheckIcon} />}
|
2023-04-24 06:24:53 +10:00
|
|
|
</div>
|
2023-05-23 18:52:27 +10:00
|
|
|
</Fragment>
|
2023-04-24 06:24:53 +10:00
|
|
|
))}
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
|
|
|
|
ProgressIndicator.propTypes = {
|
|
|
|
steps: PropTypes.number.isRequired,
|
|
|
|
completed: PropTypes.number,
|
|
|
|
};
|
|
|
|
|
2023-05-09 11:11:56 +10:00
|
|
|
export default ProgressIndicator;
|