@krowdy-ui/views
Version:
React components that implement Google's Material Design.
30 lines (28 loc) • 610 B
JavaScript
import React from 'react';
import { makeStyles, Typography } from '@krowdy-ui/core';
const Price = ({
price,
multiplier,
max
}) => {
const classes = useStyles({
max,
price
});
return /*#__PURE__*/React.createElement("div", {
className: classes.price
}, /*#__PURE__*/React.createElement(Typography, {
variant: "body1"
}, Math.round(price * multiplier)));
};
const useStyles = makeStyles(theme => ({
price: {
color: theme.palette.grey[600],
position: 'absolute',
top: ({
price,
max
}) => `${100 - price / max * 100}%`
}
}));
export default Price;