2023-04-24 05:24:53 +09:00
|
|
|
import PropTypes from 'prop-types';
|
2023-05-24 00:15:17 +09:00
|
|
|
import { Fragment } from 'react';
|
|
|
|
|
2023-04-24 05:24:53 +09:00
|
|
|
import classNames from 'classnames';
|
|
|
|
|
2023-05-24 00:15:17 +09:00
|
|
|
import { Check } from 'mastodon/components/check';
|
|
|
|
|
2023-04-24 05:24:53 +09:00
|
|
|
const ProgressIndicator = ({ steps, completed }) => (
|
|
|
|
<div className='onboarding__progress-indicator'>
|
|
|
|
{(new Array(steps)).fill().map((_, i) => (
|
2023-05-23 17:52:27 +09:00
|
|
|
<Fragment key={i}>
|
2023-04-24 05:24:53 +09:00
|
|
|
{i > 0 && <div className={classNames('onboarding__progress-indicator__line', { active: completed > i })} />}
|
|
|
|
|
|
|
|
<div className={classNames('onboarding__progress-indicator__step', { active: completed > i })}>
|
|
|
|
{completed > i && <Check />}
|
|
|
|
</div>
|
2023-05-23 17:52:27 +09:00
|
|
|
</Fragment>
|
2023-04-24 05:24:53 +09:00
|
|
|
))}
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
|
|
|
|
ProgressIndicator.propTypes = {
|
|
|
|
steps: PropTypes.number.isRequired,
|
|
|
|
completed: PropTypes.number,
|
|
|
|
};
|
|
|
|
|
2023-05-09 10:11:56 +09:00
|
|
|
export default ProgressIndicator;
|