Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Home banners #16

Merged
merged 2 commits into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added assets/credit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/crypto.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/fedex-ad.png

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove unnecessary file

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/fedex-banner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/furniture-banner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions assets/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ const images = {
filterIcon: () => require('./filter_list.png'),
trashIcon: () => require('./trash.png'),
plusIcon: () => require('./plus.png'),
fedexBanner: () => require('./fedex-banner.png'),
furnitureBanner: () => require('./furniture-banner.png'),
creditCard: () => require('./credit.png'),
paypal: () => require('./paypal.png'),
crypto: () => require('./crypto.png'),
};

export type Images = keyof typeof images;
Expand Down
Binary file added assets/paypal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
42 changes: 39 additions & 3 deletions src/app/(app)/index.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,48 @@
import images from 'assets';

import { HeaderLogo } from '@/components/header-logo';
import { Banner } from '@/components/home/bannner';
import { HorizontalCarousel } from '@/components/home/carousel';
import { SafeAreaView } from '@/ui';
import PaymentMethods from '@/components/home/payment-methods';
import { SafeAreaView, ScrollView, Text, View } from '@/ui';

export default function Feed() {
return (
<SafeAreaView>
<SafeAreaView className="bg-light_background">
<HeaderLogo />
<HorizontalCarousel />
<ScrollView className="mb-6">
<HorizontalCarousel />
<Banner
alignment="left"
background="dark"
image={images.furnitureBanner()}
>
<Text className="mb-2 font-semibold color-white">
Check out our new and restored furniture
</Text>
<Text className="color-white">
Shop today and get a 10% discount!
</Text>
</Banner>
<View className="bg-white">
<Text className="mb-8 mt-4 self-center text-lg font-bold">
Payment methods
</Text>
<PaymentMethods />
</View>
<Banner
alignment="right"
background="dark"
image={images.fedexBanner()}
>
<Text className="mb-2 font-semibold color-white">
We upgraded our shipments many levels up
</Text>
<Text className="color-white">
Powered by <Text className="color-green-400">FedEx</Text>
</Text>
</Banner>
</ScrollView>
</SafeAreaView>
);
}
41 changes: 41 additions & 0 deletions src/components/home/bannner.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { Image, View } from '@/ui';

type BannerProps = {
background: string;
alignment: 'left' | 'right';
image: any;
children: React.ReactNode;
};

export const Banner = ({
background,
alignment,
image,
children,
}: BannerProps) => {
const isLeftAligned = alignment === 'left';

return (
<View
className={`my-6 flex h-40 w-full gap-px overflow-hidden rounded-lg px-6 ${
isLeftAligned ? 'flex-row' : 'flex-row-reverse'
}`}
>
<Image
source={image}
contentFit="cover"
className={`h-full w-[47%] ${
isLeftAligned ? 'rounded-l-lg' : 'rounded-r-lg'
}`}
/>

<View
className={`flex h-full w-[53%] items-start justify-center p-6 ${background} ${
isLeftAligned ? 'rounded-r-lg' : 'rounded-l-lg'
} ${background === 'dark' ? 'bg-dark_violet' : ''}`}
>
{children}
</View>
</View>
);
};
38 changes: 38 additions & 0 deletions src/components/home/payment-methods.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import images from 'assets';

import { Image, Text, TouchableOpacity, View } from '@/ui';

const PaymentMethods = () => {
return (
<View className="my-4 h-20 w-4/5 flex-row items-center justify-evenly self-center">
<TouchableOpacity className="mx-3 items-center justify-items-center">
<Image
source={images.creditCard()}
className="mb-6 h-9 w-9"
contentFit="contain"
/>
<Text>Credit</Text>
</TouchableOpacity>
<View className="mx-5 h-full w-px bg-black" />
<TouchableOpacity className="mx-3 items-center justify-items-center">
<Image
source={images.paypal()}
className="mb-6 h-9 w-9"
contentFit="contain"
/>
<Text>Paypal</Text>
</TouchableOpacity>
<View className="mx-5 h-full w-px bg-black" />
<TouchableOpacity className="mx-3 items-center justify-items-center">
<Image
source={images.crypto()}
className="mb-6 h-9 w-9"
contentFit="contain"
/>
<Text>Crypto</Text>
</TouchableOpacity>
</View>
);
};

export default PaymentMethods;
Loading