winbox-ui-next
Version:
We Design Vue 2.0: A Vue.js 3 UI Library
10 lines (9 loc) • 353 B
JavaScript
import NP from "number-precision";
const getOffsetPercent = (value, [min, max]) => {
const percent = (value - min) / (max - min);
return `${NP.round(percent * 100, 2)}%`;
};
const getPositionStyle = (offset, direction) => {
return direction === "vertical" ? { bottom: offset } : { left: offset };
};
export { getOffsetPercent, getPositionStyle };