@brizy/ui
Version:
React elements in Brizy style
47 lines (46 loc) • 1.53 kB
JavaScript
import { getHexByColorType } from "../utils/colors";
import { BRZ_PREFIX } from "../constants";
export const getHoverColor = (color) => {
return { [`--${BRZ_PREFIX}-btn-hover`]: getHexByColorType(color) };
};
export const getColor = (color) => {
return { [`--${BRZ_PREFIX}-btn-color`]: getHexByColorType(color) };
};
export const getDisabledWidth = (fullWidth) => {
return fullWidth ? { [`--${BRZ_PREFIX}-btn-disabled-width`]: "100%" } : {};
};
export const getCustomSize = (size) => {
var _a, _b;
switch (typeof size) {
case "number":
return { [`--${BRZ_PREFIX}-btn-custom`]: `${size}px` };
case "object":
return { [`--${BRZ_PREFIX}-btn-custom`]: `${(_a = size["x"]) !== null && _a !== void 0 ? _a : 0}px ${(_b = size["y"]) !== null && _b !== void 0 ? _b : 0}px` };
default:
return {};
}
};
export const getRadius = (radius) => {
if (typeof radius === "number") {
return {
[`--${BRZ_PREFIX}-btn-radius`]: `${radius}px`,
};
}
if (typeof radius === "string") {
switch (radius) {
case "none":
return {
[`--${BRZ_PREFIX}-btn-radius`]: "0px",
};
case "round":
return {
[`--${BRZ_PREFIX}-btn-radius`]: "50%",
};
case "rounded":
return {
[`--${BRZ_PREFIX}-btn-radius`]: "3px",
};
}
}
return {};
};