PluginProbe
ElasticPress / 4.2.2
ElasticPress v4.2.2
5.3.5 5.3.4 3.6.5 3.6.6 4.0.0 4.0.1 4.1.0 4.2.0 4.2.1 4.2.2 4.3.0 4.3.1 4.4.0 4.4.1 4.5.0 4.5.1 4.5.2 4.6.0 4.6.1 4.7.0 4.7.1 4.7.2 5.0.0 5.0.1 5.0.2 All 108 releases
elasticpress / assets / js / sync / components / common / progress-bar.js

progress-bar.js in ElasticPress 4.2.2, at assets/js/sync/components/common/progress-bar.js

33 lines 791 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /**
2 * WordPress dependencies.
3 */
4 import { WPElement } from '@wordpress/element';
5
6 /**
7 * Progress bar component.
8 *
9 * @param {object} props Component props.
10 * @param {number} props.current Current value.
11 * @param {number} props.total Current total.
12 * @param {boolean} props.isComplete If operation is complete.
13 * @returns {WPElement} Component.
14 */
15 export default ({ isComplete, current, total }) => {
16 const now = Math.floor((current / total) * 100);
17
18 return (
19 <div
20 aria-valuemax={100}
21 aria-valuemin={0}
22 aria-valuenow={now}
23 className={`ep-sync-progress-bar ${isComplete ? `ep-sync-progress-bar--complete` : ``}`}
24 role="progressbar"
25 >
26 <div
27 className="ep-sync-progress-bar__progress"
28 style={{ minWidth: `${now}%` }}
29 >{`${now}%`}</div>
30 </div>
31 );
32 };
33