mirror of
https://github.com/plausible/analytics.git
synced 2024-12-22 00:51:36 +03:00
32937c53d1
* Upgrade config file * Upgrade grey colour * Update styles for dashboard * Update styles for new site flow * Update styles for user settings * Update site setting styles * Update other pages * Adjust spacing * Update last grey rules * Purge css
21 lines
392 B
JavaScript
21 lines
392 B
JavaScript
import React from 'react';
|
|
|
|
function barWidth(count, all) {
|
|
let maxVal = all[0].count;
|
|
|
|
for (const entry of all) {
|
|
if (entry.count > maxVal) maxVal = entry.count
|
|
}
|
|
|
|
return count / maxVal * 100
|
|
}
|
|
|
|
export default function Bar({count, all, bg}) {
|
|
const width = barWidth(count, all)
|
|
|
|
return (
|
|
<div className={bg} style={{width: width + '%', height: '30px'}}>
|
|
</div>
|
|
)
|
|
}
|