mirror of
https://github.com/phuoc-ng/csslayout.git
synced 2025-10-22 18:26:39 +02:00
List products on sidebar
This commit is contained in:
27
client/components/Product.tsx
Normal file
27
client/components/Product.tsx
Normal file
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* A collection of popular layouts and patterns made with CSS (https://csslayout.io)
|
||||
* (c) 2019 - 2020 Nguyen Huu Phuoc <https://twitter.com/nghuuphuoc>
|
||||
*/
|
||||
|
||||
import * as React from 'react';
|
||||
|
||||
import './product.css';
|
||||
import ProductModel from '../constants/ProductModel';
|
||||
import slug from '../helpers/slug';
|
||||
|
||||
interface ProductProps {
|
||||
product: ProductModel;
|
||||
}
|
||||
|
||||
const Product: React.FC<ProductProps> = ({ product }) => {
|
||||
return (
|
||||
<div className="product">
|
||||
<a href={product.url}>
|
||||
<img className="product__logo" src={`/assets/${slug(product.name)}.png`} alt={`${product.name} - ${product.description}`} />
|
||||
<div className="product__desc">{product.description}</div>
|
||||
</a>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default Product;
|
22
client/components/product.css
Normal file
22
client/components/product.css
Normal file
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* A collection of popular layouts and patterns made with CSS (https://csslayout.io)
|
||||
* (c) 2019 - 2020 Nguyen Huu Phuoc <https://twitter.com/nghuuphuoc>
|
||||
*/
|
||||
|
||||
.product {
|
||||
border: 1px solid rgba(0, 0, 0, .3);
|
||||
border-radius: 0.5rem;
|
||||
margin: 1rem 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
.product a {
|
||||
text-decoration: none;
|
||||
}
|
||||
.product__logo {
|
||||
height: auto;
|
||||
width: 100%;
|
||||
}
|
||||
.product__desc {
|
||||
padding: 0.5rem;
|
||||
text-align: center;
|
||||
}
|
Reference in New Issue
Block a user