Skip to content

Commit

Permalink
Initial bugfixes and addition of number section MainPrinciples Numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
r800360 committed Apr 29, 2024
1 parent c2bd514 commit efba540
Show file tree
Hide file tree
Showing 4 changed files with 94 additions and 42 deletions.
23 changes: 23 additions & 0 deletions dfm-sideline-sidekick-app/components/NumbersSection.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import PropTypes from "prop-types";
import React from "react";

Check failure on line 2 in dfm-sideline-sidekick-app/components/NumbersSection.tsx

View workflow job for this annotation

GitHub Actions / Frontend lint and style check

'React' is defined but never used. Allowed unused vars must match /^_/u
import { Text, View } from "react-native";

import styles from "./NumbersSectionStyles";

type Props = {
property1: number;
};

export const NumbersSection = ({ property1 }: Props): JSX.Element => {
return (
<View style={styles.numbersSection}>
<View style={styles.numbersSectionElement}>
<Text style={styles.numbersSectionText}> {<>{property1}</>} </Text>
</View>
</View>
);
};

NumbersSection.propTypes = {
property1: PropTypes.oneOf([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]),
};
33 changes: 33 additions & 0 deletions dfm-sideline-sidekick-app/components/NumbersSectionStyles.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { StyleSheet } from "react-native";

const styles = StyleSheet.create({
container: {
flexDirection: "row",
alignItems: "center",
paddingTop: 15,
},
numbersSection: {
height: 50,
position: "relative",
width: 50,
},
numbersSectionElement: {
color: "--dfm-navy",
fontSize: 32,
fontWeight: 400,
left: 0,
letterSpacing: 0.64,
lineHeight: 48,
position: "absolute",
top: -1,
whitespace: "nowrap",
width: 40,
},
numbersSectionText: {
fontSize: 32,
fontWeight: "400",
color: "rgba(24, 43, 73, 1)",
},
});

export default styles;
4 changes: 0 additions & 4 deletions dfm-sideline-sidekick-app/components/StringRenderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@ const BulletList: React.FC<{ items: string[] }> = ({ items }) => (
);

const StringRenderer: React.FC<Props> = ({ data }) => {
console.log(data);
console.log(Array.isArray(data));
console.log(typeof data);
console.log("\n");
if (typeof data === "string") {
return <Text style={styles.descriptionInfo}>{data}</Text>;
} else if (Array.isArray(data) && data.every((item) => typeof item === "string")) {
Expand Down
76 changes: 38 additions & 38 deletions dfm-sideline-sidekick-app/pages/MainPrinciples.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
} from "react-native";
import Icon from "react-native-vector-icons/Feather";

import { NumbersSection } from "../components/NumbersSection";
import { Bookmark } from "../components/bookmark";

import styles from "./MainPrinciplesStyles";
Expand Down Expand Up @@ -123,45 +124,44 @@ export default function MainPrinciples({ route, navigation }: Props) {
<View style={styles.topRightContainer}>
<Bookmark item={generalPrinciple} />
</View>
<ScrollView alwaysBounceHorizontal={false} contentContainerStyle={{ flexGrow: 1 }}>
<TouchableOpacity
onPress={() => {
navigation.goBack();
}}
>
{/* eslint-disable-next-line @typescript-eslint/no-unsafe-assignment */}
<Image style={styles.image} source={require("../assets/ic_caretleft.png")} />
</TouchableOpacity>
<View style={styles.margin}>
{/* <Text style={styles.subtitle}>General Principle</Text> */}
{generalPrinciple && <Text style={styles.title}>{generalPrinciple.title}</Text>}
</View>
<View>
<View style={styles.resultList}>
<FlatList
data={overviewHeaders}
// keyExtractor={(item) => item._id}
ItemSeparatorComponent={() => <View style={styles.divider} />}
renderItem={({ item }) => (
<TouchableOpacity
style={styles.listItemContainer}
onPress={() => {
handlePress(item);
}}
>
<View style={styles.listItemTextContainer}>
<Text style={styles.listItemTitle}>{item}</Text>
<Text style={styles.listItemSubtitle}>
{generalPrinciple?.overview[item].subheader}
</Text>
</View>
<Icon name="chevron-right" size={20} color="#909090" />
</TouchableOpacity>
)}
/>
</View>
<TouchableOpacity
onPress={() => {
navigation.goBack();
}}
>
{/* eslint-disable-next-line @typescript-eslint/no-unsafe-assignment */}
<Image style={styles.image} source={require("../assets/ic_caretleft.png")} />
</TouchableOpacity>
<View style={styles.margin}>
{/* <Text style={styles.subtitle}>General Principle</Text> */}
{generalPrinciple && <Text style={styles.title}>{generalPrinciple.title}</Text>}
</View>
<View>
<View style={styles.resultList}>
<FlatList
data={overviewHeaders}
// keyExtractor={(item) => item._id}
ItemSeparatorComponent={() => <View style={styles.divider} />}
renderItem={({ item, index }) => (
<TouchableOpacity
style={styles.listItemContainer}
onPress={() => {
handlePress(item);
}}
>
<NumbersSection property1={index + 1}></NumbersSection>
<View style={styles.listItemTextContainer}>
<Text style={styles.listItemTitle}>{item}</Text>
<Text style={styles.listItemSubtitle}>
{generalPrinciple?.overview[item].subheader}
</Text>
</View>
<Icon name="chevron-right" size={20} color="#909090" />
</TouchableOpacity>
)}
/>
</View>
</ScrollView>
</View>
</SafeAreaView>
);
}

0 comments on commit efba540

Please sign in to comment.