-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from TritonSE/general-principles-page
General principles page
- Loading branch information
Showing
11 changed files
with
1,753 additions
and
67 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import React from "react"; | ||
import { Text, View } from "react-native"; | ||
|
||
import styles from "./BulletPointStyles"; | ||
|
||
type Subpoint = { | ||
text: string; | ||
subpoints?: Subpoint[]; | ||
}; | ||
|
||
type BulletPointProps = { | ||
letter: string; | ||
text: string; | ||
subpoints?: Subpoint[]; | ||
}; | ||
|
||
const BulletPoint: React.FC<BulletPointProps> = ({ letter, text, subpoints: initSubpoints }) => { | ||
// render subpoints recursively | ||
const renderSubpoints = (subpoints: Subpoint[], level = 0) => { | ||
const markers = [ | ||
["1", "2", "3"], // Level 0 markers | ||
["a", "b", "c"], // Level 1 markers | ||
["i", "ii", "iii"], // Level 2 markers | ||
]; | ||
|
||
// ensure the level has defined markers, if not, default to numeric | ||
const currentMarkers = markers[level] || markers[0]; | ||
|
||
return subpoints.map((subpoint, index) => ( | ||
<View key={`${level}-${index}`} style={{ paddingLeft: level * 20 }}> | ||
<Text style={styles.point}> | ||
{`${currentMarkers[index % currentMarkers.length]}. `} | ||
{subpoint.text} | ||
</Text> | ||
{subpoint.subpoints && ( | ||
<View style={{ paddingLeft: 20 }}>{renderSubpoints(subpoint.subpoints, level + 1)}</View> | ||
)} | ||
</View> | ||
)); | ||
}; | ||
|
||
return ( | ||
<View> | ||
<View style={styles.container}> | ||
<View style={styles.circle}> | ||
<Text style={styles.circleCaption}>{letter}</Text> | ||
</View> | ||
<Text style={styles.mainText}>{text}</Text> | ||
</View> | ||
<View style={styles.subpoints}>{initSubpoints && renderSubpoints(initSubpoints)}</View> | ||
</View> | ||
); | ||
}; | ||
|
||
export default BulletPoint; |
42 changes: 42 additions & 0 deletions
42
dfm-sideline-sidekick-app/components/BulletPointStyles.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { StyleSheet } from "react-native"; | ||
|
||
const styles = StyleSheet.create({ | ||
container: { | ||
flexDirection: "row", | ||
alignItems: "center", | ||
paddingTop: 15, | ||
}, | ||
circle: { | ||
width: 24, // this should be a "props"-value in future | ||
height: 24, // this should be a "props"-value in future | ||
borderRadius: 24 / 2, | ||
backgroundColor: "#00629B", | ||
alignItems: "center", | ||
justifyContent: "center", | ||
}, | ||
|
||
circleCaption: { | ||
fontSize: 14, | ||
color: "white", | ||
fontWeight: "600", | ||
}, | ||
mainText: { | ||
color: "black", | ||
fontSize: 16, | ||
fontFamily: "Roboto-Bold", | ||
fontWeight: "700", | ||
paddingLeft: 5, | ||
}, | ||
subpoints: { | ||
paddingTop: 5, | ||
paddingLeft: 38, | ||
paddingRight: 25, | ||
fontFamily: "Roboto-Regular", | ||
}, | ||
point: { | ||
fontSize: 15, | ||
fontFamily: "Roboto-Regular", | ||
}, | ||
}); | ||
|
||
export default styles; |
Oops, something went wrong.