reactstrap#CardFooter TypeScript Examples
The following examples show how to use
reactstrap#CardFooter.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Home.tsx From reference-merchant with Apache License 2.0 | 5 votes |
function Home(props) {
const { t } = useTranslation("layout");
const [selectedProduct, setSelectedProduct] = useState<Product>();
const [products, setProducts] = useState<Product[] | undefined>();
const [demoMode, setDemoMode] = useState<boolean>(props.demoMode === undefined ? false : true);
const getProducts = async () => {
try {
setProducts(await new BackendClient().getProductsList());
} catch (e) {
console.error(e);
}
};
useEffect(() => {
//noinspection JSIgnoredPromiseFromCall
getProducts();
}, []);
return (
<>
<TestnetWarning />
<Container>
<h1 className="text-center font-weight-bold mt-5">{t("name")}</h1>
<section className="mt-5">
{products && (
<Row>
{products.map((product, i) => (
<Col key={product.gtin} md={6} lg={4}>
<Card key={product.gtin} className="mb-4">
<CardImg top src={product.image_url} />
<CardBody>
<CardTitle className="font-weight-bold h5">{product.name}</CardTitle>
<CardText>{product.description}</CardText>
</CardBody>
<CardFooter>
<Row>
<Col>
<div>
<strong>Price:</strong> {product.price / 1000000} {product.currency}
</div>
</Col>
<Col lg={4} className="text-right">
<Button
color="secondary"
block
className="btn-sm"
onClick={() => setSelectedProduct(products[i])}
>
Buy Now
</Button>
</Col>
</Row>
</CardFooter>
</Card>
</Col>
))}
</Row>
)}
{!products && <ProductsLoader />}
</section>
</Container>
<Payment
demoMode={demoMode}
product={selectedProduct}
isOpen={!!selectedProduct}
onClose={() => setSelectedProduct(undefined)}
/>
</>
);
}