lbry-desktop/ui/component/ratioBar/view.jsx
mayeaux 0c4f85fe53
MAKE ODYSEE EVEN MORE BEAUTIFUL (#539)
WE LOVE YOU RAPHAEL FOR MAKING THIS HAPPEN!
2022-02-11 13:50:55 -05:00

25 lines
575 B
JavaScript

// @flow
import React from 'react';
type Props = {
likeCount: number,
dislikeCount: number,
};
const RatioBar = (props: Props) => {
const { likeCount, dislikeCount } = props;
const like = (1 / (likeCount + dislikeCount)) * likeCount;
if (like || dislikeCount) {
return (
<div className={'ratio-bar'}>
<div className={'ratio-bar-like'} style={{ flex: like }} />
<div className={'ratio-bar-dislike'} style={{ flex: 1 - like }} />
</div>
);
} else {
return <div className={'ratio-bar'} />;
}
};
export default RatioBar;