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

Enhance product details on native #1381

Merged
merged 1 commit into from
Dec 19, 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
12 changes: 6 additions & 6 deletions packages/app/modules/item/components/ItemDetailsSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export function ItemDetailsSection({
isProductScreen?: boolean;
}) {
const styles = useCustomStyles(loadStyles);
const { gtSm } = useResponsive();
const { sm } = useResponsive();
const { overlayProps, onTriggerOpen } = useItemPackPicker();
const productDetails = useMemo(
() => parseProductDetails(itemData.productDetails),
Expand All @@ -44,7 +44,7 @@ export function ItemDetailsSection({
style={[
styles.contentContainer,
isProductScreen
? { flexDirection: gtSm ? 'row' : 'column', gap: 10 }
? { flexDirection: sm ? 'column' : 'row', gap: 10 }
: undefined,
]}
>
Expand All @@ -57,7 +57,6 @@ export function ItemDetailsSection({
</RButton>
<ImageGallery images={itemData.images?.map(({ url }) => url) || []} />
</View>

<RStack style={styles.detailsContainer}>
<ItemDetailsContent
itemData={{
Expand Down Expand Up @@ -100,7 +99,7 @@ const parseProductDetails = (details?: string) => {

const loadStyles = (theme: any) => {
const { currentTheme } = useTheme();
const { xxs } = useResponsive();
const { sm } = useResponsive();

return {
container: {
Expand All @@ -109,11 +108,12 @@ const loadStyles = (theme: any) => {
backgroundColor: currentTheme.colors.background,
},
contentContainer: {
flexDirection: xxs ? 'column' : 'row',
alignItems: 'stretch',
},
imageContainer: {
flex: 1,
height: 400,
minHeight: 400,
width: sm ? '100%' : '50%',
backgroundColor: currentTheme.colors.border,
justifyContent: 'center',
alignItems: 'center',
Expand Down
60 changes: 33 additions & 27 deletions packages/app/modules/item/screens/ItemDetailsScreen.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { RScrollView, RStack, RH3, RText } from '@packrat/ui';
import { RStack, RH3, RText } from '@packrat/ui';
import { useItem, useItemId } from 'app/modules/item';
import { ItemDetailsSection } from '../components/ItemDetailsSection';
import useTheme from 'app/hooks/useTheme';
Expand All @@ -19,40 +19,46 @@ export function ItemDetailsScreen() {
const styles = useCustomStyles(loadStyles);
const router = useRouter();

const { sm } = useResponsive();

if (isLoading) {
return null;
}

return (
<Layout>
<RStack style={{ padding: 10, width: '100%', paddingBottom: 50 }}>
<RStack style={styles.breadcrumbContainer}>
{Platform.OS === 'web' ? (
<RLink to="/products">
<RText style={styles.breadcrumbLink}>Products</RText>
</RLink>
) : (
<TouchableOpacity onPress={() => router.push('/products')}>
<RText style={styles.breadcrumbLink}>Products</RText>
</TouchableOpacity>
)}
<RStack style={styles.breadcrumbContainer}>
{Platform.OS === 'web' ? (
<RLink to="/products">
<RText style={styles.breadcrumbLink}>Products</RText>
</RLink>
) : (
<TouchableOpacity onPress={() => router.push('/products')}>
<RText style={styles.breadcrumbLink}>Products</RText>
</TouchableOpacity>
)}

<RText style={styles.breadcrumbSeparator}>/</RText>
<RText style={styles.breadcrumbSeparator}>/</RText>

{Platform.OS === 'web' ? (
<RLink to={`/products`}>
<RText style={styles.breadcrumbLink}>
{item?.category?.name}
</RText>
</RLink>
) : (
<TouchableOpacity onPress={() => router.push('/products')}>
<RText style={styles.breadcrumbLink}>
{item?.category?.name}
</RText>
</TouchableOpacity>
)}
</RStack>
{Platform.OS === 'web' ? (
<RLink to={`/products`}>
<RText style={styles.breadcrumbLink}>{item?.category?.name}</RText>
</RLink>
) : (
<TouchableOpacity onPress={() => router.push('/products')}>
<RText style={styles.breadcrumbLink}>{item?.category?.name}</RText>
</TouchableOpacity>
)}
</RStack>
<RStack
style={{
padding: 10,
width: '100%',
paddingBottom: 50,
flexDirection: sm ? 'column' : 'row',
gap: 20,
}}
>
<ItemDetailsSection itemData={item as any} isProductScreen={true} />
</RStack>
<LargeCard
Expand Down
Loading