@open-tender/ui
Version:
A component library for use with the Open Tender web app
14 lines (13 loc) • 951 B
JavaScript
import { formatDollars, formatQuantity } from '@open-tender/utils';
import React from 'react';
import { Text, View } from '../../components';
import { makeProps } from '../../utils';
const ItemTitleView = ({ config, builtItem }) => {
const { name, totalPrice, totalCals } = builtItem;
return (React.createElement(View, Object.assign({}, makeProps(config, 'item__title')),
React.createElement(Text, Object.assign({}, makeProps(config, 'item__name'), { text: name })),
React.createElement(View, Object.assign({}, makeProps(config, 'item__priceCals')),
totalPrice !== null && (React.createElement(Text, Object.assign({}, makeProps(config, 'item__price'), { text: formatDollars(totalPrice.toString()) }))),
totalCals !== null && (React.createElement(Text, Object.assign({}, makeProps(config, 'item__calories'), { text: `${formatQuantity(totalCals.toString())} Cal` }))))));
};
export default ItemTitleView;