@nexara/nativeflow
Version:
Beautiful, responsive, and customizable UI components for React Native – built for performance and seamless experiences.
101 lines (100 loc) • 1.92 kB
JavaScript
"use strict";
const getButtonBorderColor = ({
theme,
strokeColor,
disabled
}) => {
if (disabled) {
return theme.colors.outline;
}
if (strokeColor) {
return strokeColor;
}
return theme.colors.outline;
};
const getButtonTextColor = ({
theme,
checkVariant,
titleColor,
disabled
}) => {
if (disabled) {
return theme.colors.textDisable;
} else if (titleColor) {
return titleColor;
} else if (checkVariant('outlined')) {
return theme.colors.textPrimary;
}
return theme.colors.textSecondary;
};
const getButtonBackgroundColor = ({
theme,
checkVariant,
bg,
disabled
}) => {
if (disabled) {
return theme.colors.disable;
} else if (bg) {
return bg;
} else if (checkVariant('contained')) {
return theme.colors.primary;
} else if (checkVariant('outlined')) {
return 'transparent';
}
return theme.colors.primary;
};
const getButtonIconColor = ({
theme,
checkVariant,
disabled
}) => {
if (disabled) {
return theme.colors.iconDisable;
} else if (checkVariant('outlined')) {
return theme.colors.iconPrimary;
}
return theme.colors.iconSecondary;
};
const getButtonColors = ({
theme,
variant,
bg,
titleColor,
strokeColor,
disabled
}) => {
const checkVariant = variantToCompare => {
return variant === variantToCompare;
};
const backgroundColor = getButtonBackgroundColor({
theme,
checkVariant,
bg,
disabled
});
const buttonTextColor = getButtonTextColor({
theme,
checkVariant,
titleColor,
disabled
});
const buttonBorderColor = getButtonBorderColor({
theme,
strokeColor,
disabled
});
const buttonIconColor = getButtonIconColor({
checkVariant,
theme,
disabled
});
return {
backgroundColor,
buttonTextColor,
buttonBorderColor,
buttonIconColor
};
};
export { getButtonColors };
//# sourceMappingURL=utils.js.map