Created
October 17, 2024 13:48
-
-
Save Klerith/56f76981437bf59f3db06b127b456bd5 to your computer and use it in GitHub Desktop.
Tarjeta para mostrar un producto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface Props { | |
product: Product; | |
} | |
export const ProductCard = ({ product }: Props) => { | |
return ( | |
<ThemedView | |
style={{ | |
flex: 1, | |
backgroundColor: '#F9F9F9', | |
margin: 3, | |
borderRadius: 5, | |
overflow: 'hidden', | |
padding: 5, | |
}} | |
> | |
<TouchableOpacity onPress={() => router.push(`/product/${product.id}`)}> | |
{product.images.length === 0 ? ( | |
<Image | |
source={require('../../../assets/images/no-product-image.png')} | |
style={{ width: '100%', height: 200 }} | |
/> | |
) : ( | |
<Image | |
source={{ uri: product.images[0] }} | |
style={{ flex: 1, height: 200, width: '100%' }} | |
/> | |
)} | |
<ThemedText | |
numberOfLines={2} | |
style={{ textAlign: 'center' }} | |
darkColor={'black'} | |
> | |
{product.title} | |
</ThemedText> | |
</TouchableOpacity> | |
</ThemedView> | |
); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment