Skip to content

Commit

Permalink
Connect to StoreSelectModal
Browse files Browse the repository at this point in the history
  • Loading branch information
koredefashokun committed Oct 18, 2024
1 parent 8387b24 commit 90781d9
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 5 deletions.
4 changes: 2 additions & 2 deletions apps/app/src/screens/Profile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ const Profile: React.FC = () => {
<ProfileRow title='About this app' onPress={noop} />
<ProfileRow title='Support' onPress={noop} />
</View>
<Spacer y={16} />
<View style={{ paddingHorizontal: 16, marginTop: 8 }}>
<Spacer y={24} />
<View style={{ paddingHorizontal: 16 }}>
<Button text='Log Out' onPress={logOut} />
</View>
</Screen>
Expand Down
11 changes: 8 additions & 3 deletions apps/dashboard/src/components/store/StoreProfile.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { BottomSheetModal } from '@gorhom/bottom-sheet';
import { Typography, useTheme } from '@habiti/components';
import React from 'react';
import { View, StyleSheet } from 'react-native';
import { View, StyleSheet, Pressable } from 'react-native';

import StoreSelectModal from './StoreSelectModal';
import { StoreQuery } from '../../types/api';

interface StoreProfileProps {
Expand All @@ -10,19 +12,22 @@ interface StoreProfileProps {

const StoreProfile: React.FC<StoreProfileProps> = ({ store }) => {
const { theme } = useTheme();
const modalRef = React.useRef<BottomSheetModal>(null);

return (
<View style={styles.container}>
<View
<Pressable
style={[styles.avatar, { backgroundColor: theme.image.placeholder }]}
onPress={() => modalRef.current?.present()}
>
<Typography weight='medium' size='xxxlarge' style={styles.avatarText}>
{store.name[0]}
</Typography>
</View>
</Pressable>
<Typography weight='medium' size='xxlarge' style={styles.name}>
{store.name}
</Typography>
<StoreSelectModal modalRef={modalRef} />
</View>
);
};
Expand Down
43 changes: 43 additions & 0 deletions apps/dashboard/src/components/store/StoreSelectModal.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import {
BottomSheetBackdrop,
BottomSheetModal,
BottomSheetView
} from '@gorhom/bottom-sheet';
import { Button, Spacer, Typography, useTheme } from '@habiti/components';
import { useSafeAreaInsets } from 'react-native-safe-area-context';

interface StoreSelectModalProps {
modalRef: React.RefObject<BottomSheetModal>;
}

const StoreSelectModal: React.FC<StoreSelectModalProps> = ({ modalRef }) => {
const { theme } = useTheme();
const { bottom } = useSafeAreaInsets();

return (
<BottomSheetModal
ref={modalRef}
enableDynamicSizing
backdropComponent={props => (
<BottomSheetBackdrop
{...props}
pressBehavior='close'
disappearsOnIndex={-1}
appearsOnIndex={0}
/>
)}
handleIndicatorStyle={{ backgroundColor: theme.text.primary }}
backgroundStyle={{ backgroundColor: theme.screen.background }}
>
<BottomSheetView style={{ paddingBottom: bottom, paddingHorizontal: 16 }}>
<Typography size='xlarge' weight='medium'>
Select store
</Typography>
<Spacer y={16} />
<Button onPress={() => {}} text='Create new store' />
</BottomSheetView>
</BottomSheetModal>
);
};

export default StoreSelectModal;

0 comments on commit 90781d9

Please sign in to comment.