UNPKG

@open-tender/ui

Version:

A component library for use with the Open Tender web app

17 lines (16 loc) 1.28 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const tslib_1 = require("tslib"); const utils_1 = require("@open-tender/utils"); const react_1 = tslib_1.__importDefault(require("react")); const components_1 = require("../../components"); const utils_2 = require("../../utils"); const ItemTitleView = ({ config, builtItem }) => { const { name, totalPrice, totalCals } = builtItem; return (react_1.default.createElement(components_1.View, Object.assign({}, (0, utils_2.makeProps)(config, 'item__title')), react_1.default.createElement(components_1.Text, Object.assign({}, (0, utils_2.makeProps)(config, 'item__name'), { text: name })), react_1.default.createElement(components_1.View, Object.assign({}, (0, utils_2.makeProps)(config, 'item__priceCals')), totalPrice !== null && (react_1.default.createElement(components_1.Text, Object.assign({}, (0, utils_2.makeProps)(config, 'item__price'), { text: (0, utils_1.formatDollars)(totalPrice.toString()) }))), totalCals !== null && (react_1.default.createElement(components_1.Text, Object.assign({}, (0, utils_2.makeProps)(config, 'item__calories'), { text: `${(0, utils_1.formatQuantity)(totalCals.toString())} Cal` })))))); }; exports.default = ItemTitleView;