mirror of
https://github.com/abhay-raizada/PeerScribe.git
synced 2026-04-26 16:24:03 +00:00
Add Collapsible Sections
This commit is contained in:
@@ -27,7 +27,6 @@ export const PatientForm: React.FC<PatientFormProps> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Section title="Patient">
|
|
||||||
<View>
|
<View>
|
||||||
<View>
|
<View>
|
||||||
<Text style={TextTheme}>Name</Text>
|
<Text style={TextTheme}>Name</Text>
|
||||||
@@ -72,6 +71,5 @@ export const PatientForm: React.FC<PatientFormProps> = ({
|
|||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
</Section>
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -196,6 +196,7 @@ export const PrescriptionCreator = () => {
|
|||||||
<View
|
<View
|
||||||
style={{
|
style={{
|
||||||
backgroundColor: Colors.black,
|
backgroundColor: Colors.black,
|
||||||
|
minHeight: Dimensions.get('window').height,
|
||||||
}}>
|
}}>
|
||||||
<Image
|
<Image
|
||||||
style={{
|
style={{
|
||||||
@@ -234,19 +235,17 @@ export const PrescriptionCreator = () => {
|
|||||||
|
|
||||||
<Section title="Prescription">
|
<Section title="Prescription">
|
||||||
<View style={{display: 'flex', flexDirection: 'column', width: '100%'}}>
|
<View style={{display: 'flex', flexDirection: 'column', width: '100%'}}>
|
||||||
<PatientForm nestedFormCallback={nestedFormCallback} />
|
<Section title="Patient" collapsible={true}>
|
||||||
<AddressForm nestedFormCallback={nestedFormCallback} />
|
|
||||||
<MedicineForm nestedFormCallback={nestedFormCallback} />
|
|
||||||
<Button onPress={handleButtonPress} title="Create Rx" />
|
|
||||||
{/* <Text
|
|
||||||
style={[
|
|
||||||
{
|
|
||||||
color: Colors.light,
|
|
||||||
},
|
|
||||||
]}>
|
|
||||||
{' '}
|
{' '}
|
||||||
</Text>
|
<PatientForm nestedFormCallback={nestedFormCallback} />
|
||||||
</Button> */}
|
</Section>
|
||||||
|
<Section title="Address" collapsible={true}>
|
||||||
|
<AddressForm nestedFormCallback={nestedFormCallback} />
|
||||||
|
</Section>
|
||||||
|
<Section title="Medicine" collapsible={true}>
|
||||||
|
<MedicineForm nestedFormCallback={nestedFormCallback} />
|
||||||
|
</Section>
|
||||||
|
<Button onPress={handleButtonPress} title="Create Rx" />
|
||||||
</View>
|
</View>
|
||||||
</Section>
|
</Section>
|
||||||
<ImportNsec
|
<ImportNsec
|
||||||
|
|||||||
@@ -1,17 +1,44 @@
|
|||||||
import {PropsWithChildren} from 'react';
|
import {PropsWithChildren, useState} from 'react';
|
||||||
import {Dimensions, StyleSheet, Text, View} from 'react-native';
|
import {
|
||||||
|
Dimensions,
|
||||||
|
StyleSheet,
|
||||||
|
Text,
|
||||||
|
Touchable,
|
||||||
|
TouchableOpacity,
|
||||||
|
View,
|
||||||
|
} from 'react-native';
|
||||||
import {Colors} from 'react-native/Libraries/NewAppScreen';
|
import {Colors} from 'react-native/Libraries/NewAppScreen';
|
||||||
import {styles} from './styles';
|
import {styles} from './styles';
|
||||||
|
|
||||||
type SectionProps = PropsWithChildren<{
|
type SectionProps = PropsWithChildren<{
|
||||||
title: string;
|
title: string;
|
||||||
|
collapsible?: boolean;
|
||||||
}>;
|
}>;
|
||||||
|
|
||||||
export function Section({children, title}: SectionProps): React.JSX.Element {
|
export function Section({
|
||||||
|
children,
|
||||||
|
title,
|
||||||
|
collapsible,
|
||||||
|
}: SectionProps): React.JSX.Element {
|
||||||
|
const [collapsed, setCollapsed] = useState(true);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={styles.sectionContainer}>
|
<View style={styles.sectionContainer}>
|
||||||
|
{collapsible ? (
|
||||||
|
<TouchableOpacity
|
||||||
|
onPress={() => {
|
||||||
|
setCollapsed(!collapsed);
|
||||||
|
}}>
|
||||||
|
<Text style={styles.sectionTitle}>
|
||||||
|
{title} {collapsed ? '→' : '↓'}
|
||||||
|
</Text>
|
||||||
|
</TouchableOpacity>
|
||||||
|
) : (
|
||||||
<Text style={styles.sectionTitle}>{title}</Text>
|
<Text style={styles.sectionTitle}>{title}</Text>
|
||||||
|
)}
|
||||||
|
{!collapsible || !collapsed ? (
|
||||||
<Text style={[styles.sectionDescription]}>{children}</Text>
|
<Text style={[styles.sectionDescription]}>{children}</Text>
|
||||||
|
) : null}
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,9 @@
|
|||||||
"buffer": "^6.0.3",
|
"buffer": "^6.0.3",
|
||||||
"events": "^3.3.0",
|
"events": "^3.3.0",
|
||||||
"nostr-tools": "^2.3.1",
|
"nostr-tools": "^2.3.1",
|
||||||
|
"react-native-safe-area-context": "^4.5.0",
|
||||||
|
"@rneui/base": "^4.0.0-rc.8",
|
||||||
|
"@rneui/themed": "^4.0.0-rc.8",
|
||||||
"react": "18.2.0",
|
"react": "18.2.0",
|
||||||
"react-native": "0.73.4",
|
"react-native": "0.73.4",
|
||||||
"react-native-crypto": "^2.2.0",
|
"react-native-crypto": "^2.2.0",
|
||||||
|
|||||||
Reference in New Issue
Block a user