generated from clerk/t3-turbo-and-clerk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Product List and Tab Navigation
- Loading branch information
Diego Romero
committed
Nov 22, 2023
1 parent
623ddd7
commit bae7c4b
Showing
5 changed files
with
233 additions
and
36 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import type { AppRouter } from "@acme/api"; | ||
import type { inferProcedureOutput } from "@trpc/server"; | ||
import { memo } from "react"; | ||
import { View, Image, Text } from "react-native"; | ||
|
||
export interface ProductCardProps { | ||
item: inferProcedureOutput<AppRouter["item"]["byId"]>; | ||
} | ||
|
||
function ProductCard({ item }: ProductCardProps) { | ||
const hasStock = item.stock.greaterThan(0); | ||
|
||
return ( | ||
<View className="flex flex-row items-center rounded border border-gray-200 bg-white p-2 py-4 shadow"> | ||
<Image | ||
source={{ uri: item.image_url ?? "" }} | ||
className="h-20 w-20" | ||
resizeMode="contain" | ||
/> | ||
<View className="flex h-full items-start "> | ||
<Text numberOfLines={1} className="text-base font-semibold"> | ||
{item.name} | ||
</Text> | ||
|
||
{hasStock && ( | ||
<Text numberOfLines={1} className="font-base text-lg"> | ||
{item.price ? `C$ ${item.price}` : "Free"} | ||
</Text> | ||
)} | ||
|
||
<View> | ||
{hasStock ? ( | ||
<Text className="text-base text-green-900"> | ||
{item.stock.toNumber()} Disponible | ||
</Text> | ||
) : ( | ||
<View> | ||
<Text className="text-base text-red-900">No Disponible</Text> | ||
</View> | ||
)} | ||
</View> | ||
</View> | ||
</View> | ||
); | ||
} | ||
|
||
export default memo(ProductCard); |
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
Oops, something went wrong.