@krowdy-ui/views
Version:
React components that implement Google's Material Design.
33 lines (31 loc) • 897 B
JavaScript
import React from 'react';
import { makeStyles, Typography } from '@krowdy-ui/core';
var Price = function Price(_ref) {
var price = _ref.price,
index = _ref.index,
pricePercent = _ref.pricePercent;
var calc = pricePercent * index;
var classes = useStyles({
calc: calc,
price: price
});
return /*#__PURE__*/React.createElement("div", {
className: classes.price
}, /*#__PURE__*/React.createElement(Typography, {
variant: "body1"
}, price ? Math.round(price) : ''));
};
var useStyles = makeStyles(function (theme) {
return {
price: {
color: theme.palette.grey[600],
left: function left(_ref2) {
var price = _ref2.price,
calc = _ref2.calc;
return "calc(".concat(calc, "% - ").concat(Math.round(price).toString().length * 6.85 / 2, "px)");
},
position: 'absolute'
}
};
});
export default Price;