@arpitbhalla/rneui-base-dev
Version:
Cross Platform React Native UI Toolkit
95 lines (94 loc) • 5.39 kB
JavaScript
"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.PricingCard = void 0;
var react_1 = __importDefault(require("react"));
var react_native_1 = require("react-native");
var helpers_1 = require("../helpers");
var helpers_2 = require("../helpers");
var Text_1 = require("../Text");
var PricingButton_1 = require("./components/PricingButton");
var PricingCard = function (_a) {
var _b, _c, _d;
var containerStyle = _a.containerStyle, wrapperStyle = _a.wrapperStyle, title = _a.title, price = _a.price, _e = _a.info, info = _e === void 0 ? [] : _e, button = _a.button, _f = _a.theme, theme = _f === void 0 ? helpers_1.defaultTheme : _f, _g = _a.color, color = _g === void 0 ? (_b = theme === null || theme === void 0 ? void 0 : theme.colors) === null || _b === void 0 ? void 0 : _b.primary : _g, titleStyle = _a.titleStyle, pricingStyle = _a.pricingStyle, infoStyle = _a.infoStyle, onButtonPress = _a.onButtonPress, rest = __rest(_a, ["containerStyle", "wrapperStyle", "title", "price", "info", "button", "theme", "color", "titleStyle", "pricingStyle", "infoStyle", "onButtonPress"]);
return (react_1.default.createElement(react_native_1.View, __assign({}, rest, { style: react_native_1.StyleSheet.flatten([
__assign({ margin: 15, marginBottom: 15, backgroundColor: (_c = theme === null || theme === void 0 ? void 0 : theme.colors) === null || _c === void 0 ? void 0 : _c.background, borderWidth: 1, padding: 15, borderColor: (_d = theme === null || theme === void 0 ? void 0 : theme.colors) === null || _d === void 0 ? void 0 : _d.grey5 }, react_native_1.Platform.select({
android: {
elevation: 1,
},
default: {
shadowColor: 'rgba(0,0,0, .2)',
shadowOffset: { height: 1, width: 0 },
shadowOpacity: 0.5,
shadowRadius: 0.5,
},
})),
containerStyle && containerStyle,
]) }),
react_1.default.createElement(react_native_1.View, { style: react_native_1.StyleSheet.flatten([
styles.wrapper,
wrapperStyle && wrapperStyle,
]) },
react_1.default.createElement(Text_1.Text, { testID: "pricingCardTitle", style: react_native_1.StyleSheet.flatten([
styles.pricingTitle,
titleStyle,
{ color: color },
]) }, title),
react_1.default.createElement(Text_1.Text, { style: react_native_1.StyleSheet.flatten([styles.pricingPrice, pricingStyle]) }, price), info === null || info === void 0 ? void 0 :
info.map(function (item) {
var _a;
return (react_1.default.createElement(Text_1.Text, { key: item, style: react_native_1.StyleSheet.flatten([
__assign({ textAlign: 'center', marginTop: 5, marginBottom: 5, color: (_a = theme === null || theme === void 0 ? void 0 : theme.colors) === null || _a === void 0 ? void 0 : _a.grey3 }, react_native_1.Platform.select({
android: __assign({}, helpers_2.fonts.android.bold),
default: {
fontWeight: '600',
},
})),
infoStyle,
]) }, item));
}),
react_1.default.isValidElement(button) ? (button) : (react_1.default.createElement(PricingButton_1.PricingButton, __assign({ color: color, onButtonPress: onButtonPress }, button))))));
};
exports.PricingCard = PricingCard;
var styles = react_native_1.StyleSheet.create({
wrapper: {
backgroundColor: 'transparent',
},
pricingTitle: __assign({ textAlign: 'center', fontSize: (0, helpers_1.normalizeText)(30) }, react_native_1.Platform.select({
android: __assign({}, helpers_2.fonts.android.black),
default: {
fontWeight: '800',
},
})),
pricingPrice: __assign({ textAlign: 'center', marginTop: 10, marginBottom: 10, fontSize: (0, helpers_1.normalizeText)(40) }, react_native_1.Platform.select({
android: __assign({}, helpers_2.fonts.android.bold),
default: {
fontWeight: '700',
},
})),
});
exports.PricingCard.displayName = 'PricingCard';