mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-13 08:33:58 -07:00
Initial Commit Rework
This commit is contained in:
parent
74a4cc048c
commit
95051cbd63
2483 changed files with 101351 additions and 111396 deletions
100
frontend/src/Components/ProgressBar.js
Normal file
100
frontend/src/Components/ProgressBar.js
Normal file
|
@ -0,0 +1,100 @@
|
|||
import PropTypes from 'prop-types';
|
||||
import React from 'react';
|
||||
import classNames from 'classnames';
|
||||
import { kinds, sizes } from 'Helpers/Props';
|
||||
import styles from './ProgressBar.css';
|
||||
|
||||
function ProgressBar(props) {
|
||||
const {
|
||||
className,
|
||||
containerClassName,
|
||||
title,
|
||||
progress,
|
||||
precision,
|
||||
showText,
|
||||
text,
|
||||
kind,
|
||||
size,
|
||||
width
|
||||
} = props;
|
||||
|
||||
const progressPercent = `${progress.toFixed(precision)}%`;
|
||||
const progressText = text || progressPercent;
|
||||
const actualWidth = width ? `${width}px` : '100%';
|
||||
|
||||
return (
|
||||
<div
|
||||
className={classNames(
|
||||
containerClassName,
|
||||
styles[size]
|
||||
)}
|
||||
title={title}
|
||||
style={{ width: actualWidth }}
|
||||
>
|
||||
{
|
||||
showText && !!width &&
|
||||
<div
|
||||
className={styles.backTextContainer}
|
||||
style={{ width: actualWidth }}
|
||||
>
|
||||
<div className={styles.backText}>
|
||||
<div>
|
||||
{progressText}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
<div
|
||||
className={classNames(
|
||||
className,
|
||||
styles[kind]
|
||||
)}
|
||||
aria-valuenow={progress}
|
||||
aria-valuemin="0"
|
||||
aria-valuemax="100"
|
||||
style={{ width: progressPercent }}
|
||||
/>
|
||||
{
|
||||
showText &&
|
||||
<div
|
||||
className={styles.frontTextContainer}
|
||||
style={{ width: progressPercent }}
|
||||
>
|
||||
<div
|
||||
className={styles.frontText}
|
||||
style={{ width: actualWidth }}
|
||||
>
|
||||
<div>
|
||||
{progressText}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
ProgressBar.propTypes = {
|
||||
className: PropTypes.string,
|
||||
containerClassName: PropTypes.string,
|
||||
title: PropTypes.string,
|
||||
progress: PropTypes.number.isRequired,
|
||||
precision: PropTypes.number.isRequired,
|
||||
showText: PropTypes.bool.isRequired,
|
||||
text: PropTypes.string,
|
||||
kind: PropTypes.oneOf(kinds.all).isRequired,
|
||||
size: PropTypes.oneOf(sizes.all).isRequired,
|
||||
width: PropTypes.number
|
||||
};
|
||||
|
||||
ProgressBar.defaultProps = {
|
||||
className: styles.progressBar,
|
||||
containerClassName: styles.container,
|
||||
precision: 1,
|
||||
showText: false,
|
||||
kind: kinds.PRIMARY,
|
||||
size: sizes.MEDIUM
|
||||
};
|
||||
|
||||
export default ProgressBar;
|
Loading…
Add table
Add a link
Reference in a new issue