Skip to content

Commit

Permalink
feat: improve readability (#229)
Browse files Browse the repository at this point in the history
  • Loading branch information
bhajneet committed Dec 27, 2021
1 parent 5ba85b5 commit 2e4862f
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 20 deletions.
3 changes: 2 additions & 1 deletion src/screens/Collections/Item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const styles = StyleSheet.create( {
},
container: {
...px( Units.HorizontalLayoutMargin ),
minHeight: Units.MinimumTouchDimension * Units.LineHeightMultiplier,
minHeight: Units.MinimumTouchDimension * Units.ThumbFingerRatio,
flexDirection: 'row',
justifyContent: 'space-between',
alignItems: 'center',
Expand All @@ -24,6 +24,7 @@ const styles = StyleSheet.create( {
title: {
color: Colors.PrimaryText,
fontSize: Units.Base * Units.GurmukhiLatinRatio,
lineHeight: Units.Base * Units.GurmukhiLineHeightMultiplier,
...( OS.android && { fontFamily: Fonts.MuktaMahee } ),
},
} )
Expand Down
1 change: 0 additions & 1 deletion src/screens/Gurbani/BottomBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ const styles = StyleSheet.create( {
bottom: 0,
left: 0,
right: 0,
opacity: 0.9,
},
button: {
fontSize: 28,
Expand Down
25 changes: 14 additions & 11 deletions src/screens/Gurbani/Line.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,24 @@ import transliterators from '../../lib/transliterators'
import Colors from '../../themes/colors'
import Fonts from '../../themes/fonts'
import Units from '../../themes/units'
import { px, py } from '../../themes/utils'
import { px } from '../../themes/utils'
import { TranslationData } from '../../types/data'

const styles = StyleSheet.create( {
gurbani: {
fontSize: Units.Base * Units.GurmukhiLatinRatio,
...( OS.android && { fontFamily: Fonts.MuktaMahee } ),
lineHeight: Units.Base * Units.GurmukhiLineHeightMultiplier,
},
root: {
...px( 20 ),
...py( ( Units.Base * Units.LineHeightMultiplier ) / 2 ),
paddingTop: Units.Base * Units.LineHeightMultiplier,
},
text: {
color: Colors.SecondaryText,
paddingTop: ( Units.Base * Units.LineHeightMultiplier ) / 4,
},
transliteration: {
paddingBottom: ( Units.Base * Units.LineHeightMultiplier ) / 4,
},
} )

Expand Down Expand Up @@ -52,21 +55,21 @@ const Line = ( {
<View style={styles.root}>
<Typography style={[ styles.gurbani ]}>{toUnicode( gurmukhi )}</Typography>

{translations
.filter( ( { translationSourceId } ) => translationSourceId === Languages.English )
.map( ( {
translationSourceId,
translation,
} ) => <Typography key={translationSourceId} style={styles.text}>{translation}</Typography> )}

{transliterations.map( ( language ) => (
<Typography
key={language}
style={styles.text}
style={[ styles.text, styles.transliteration ]}
>
{transliterators[ language ]( toUnicode( gurmukhi ) )}
</Typography>
) )}

{translations
.filter( ( { translationSourceId } ) => translationSourceId === Languages.English )
.map( ( {
translationSourceId,
translation,
} ) => <Typography key={translationSourceId} style={styles.text}>{translation}</Typography> )}
</View>
)

Expand Down
5 changes: 3 additions & 2 deletions src/screens/Gurbani/Lines.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@ import { stripVishraams } from 'gurmukhi-utils'
import { FlatList, StyleSheet, View } from 'react-native'

import Languages from '../../lib/languages'
import Units from '../../themes/units'
import { LineData } from '../../types/data'
import Line from './Line'

const styles = StyleSheet.create( {
linesContent: {
paddingBottom: 50,
paddingBottom: 63 + ( Units.Base * Units.LineHeightMultiplier ) / 2,
},
root: {
flex: 1,
marginBottom: -50,
marginBottom: -63,
},
} )

Expand Down
7 changes: 3 additions & 4 deletions src/screens/Search/Result.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,11 @@ import { px, py } from '../../themes/utils'
const styles = StyleSheet.create( {
gurbani: {
fontSize: Units.Base * Units.GurmukhiLatinRatio,
lineHeight: Units.Base * Units.GurmukhiLineHeightMultiplier,
...( OS.android && {
paddingBottom: 6,
fontFamily: Fonts.MuktaMahee,
} ),
...( OS.ios && {
paddingBottom: 2.5,
} ),
},
header: {
flexDirection: 'row',
Expand All @@ -32,6 +30,7 @@ const styles = StyleSheet.create( {
},
headerGurmukhi: {
fontSize: Units.Footnote * Units.GurmukhiLatinRatio,
lineHeight: Units.Footnote * Units.GurmukhiLineHeightMultiplier,
...( OS.android && { fontFamily: Fonts.MuktaMahee } ),
},
root: {
Expand All @@ -43,7 +42,7 @@ const styles = StyleSheet.create( {
},
translation: {
fontSize: Units.Footnote,
lineHeight: ( Units.Base * Units.LineHeightMultiplier ) / 2,
marginTop: -1,
},
} )

Expand Down
4 changes: 3 additions & 1 deletion src/themes/units.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ enum Units {
Title1 = 28,
Title2 = 22,
Title3 = 20,
LineHeightMultiplier = 1.75,
GurmukhiLatinRatio = 1.143,
LineHeightMultiplier = 1.25,
GurmukhiLineHeightMultiplier = 1.75,
HorizontalLayoutMargin = 20,
MinimumTouchDimension = 44,
ThumbFingerRatio = 1.5,
Separator = 0.5,
}

Expand Down

0 comments on commit 2e4862f

Please sign in to comment.