You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
13 lines
494 B
JavaScript
13 lines
494 B
JavaScript
import {Component} from "preact";
|
|
|
|
export default class Bar extends Component {
|
|
render({current, base, type}, state, context) {
|
|
const ceilCurrent = Math.ceil(current);
|
|
const perc = (ceilCurrent / base) * 100;
|
|
return <div className={`bar ${type}`}>
|
|
<div className="inner-bar" style={{width: Math.max(perc, 100) + '%'}}>
|
|
<span className="inner-text">{ceilCurrent}/{base} ({Math.ceil(perc)}%)</span>
|
|
</div>
|
|
</div>
|
|
}
|
|
} |