Skip to content

Commit

Permalink
fix(SettingsPageDesktop): Fixed style issues
Browse files Browse the repository at this point in the history
  • Loading branch information
artalat committed May 3, 2022
1 parent b7e1694 commit 2f7ee2d
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 9 deletions.
16 changes: 13 additions & 3 deletions src/layouts/SettingsPage/SettingsPageDesktop.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ import React from 'react';
import { Dimensions, ScrollView, TextStyle, ViewStyle } from 'react-native';

import { SettingsPageProps } from '../SettingsPage';
import { SettingsPageItemDesktop } from '../SettingsPageItem';
import { SettingsPageItemDesktop, SettingsPageItemDesktopStyles } from '../SettingsPageItem';

export interface SettingsPageDesktopStyles {
title: TextStyle;
root: ViewStyle;
scrollView: ViewStyle;
scrollViewContainer: ViewStyle;
item: Partial<SettingsPageItemDesktopStyles>;
}

export type SettingsPageDesktopProps = SettingsPageProps & {
Expand All @@ -23,6 +25,9 @@ const defaultStyles = (theme: Theme): SettingsPageDesktopStyles => {
root: {
flex: 1,
},
scrollView: {
flex: 1,
},
scrollViewContainer: {
height: height - theme.spacing.unit * 10,
},
Expand All @@ -31,6 +36,11 @@ const defaultStyles = (theme: Theme): SettingsPageDesktopStyles => {
paddingTop: theme.spacing.unit * 2,
paddingBottom: theme.spacing.unit,
},
item: {
root: {
marginVertical: theme.spacing.unit,
}
}
};
};

Expand All @@ -46,7 +56,7 @@ export const SettingsPageDesktop = (props: SettingsPageDesktopProps) => {

return (
<ScrollView
style={{ flex: 1 }}
style={styles.scrollView}
contentContainerStyle={styles.scrollViewContainer}
showsVerticalScrollIndicator={false}
>
Expand All @@ -56,7 +66,7 @@ export const SettingsPageDesktop = (props: SettingsPageDesktopProps) => {
<SettingsPageItemDesktop
key={item.name}
{...item}
styles={{ root: { marginVertical: 8 } }}
styles={styles.item}
/>
))}
</View>
Expand Down
18 changes: 12 additions & 6 deletions src/layouts/SettingsPageItem/SettingsPageItemDesktop.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ const defaultStyles = (theme: Theme): SettingsPageItemDesktopStyles => ({
},

titleStyles: {
paddingVertical: theme.spacing.unit,
paddingVertical: theme.spacing.unit / 2,
},

descriptionStyles: {
color: theme.palette.text.hint,
paddingBottom: theme.spacing.unit,
paddingVertical: theme.spacing.unit / 2,
},

content: {
Expand Down Expand Up @@ -74,10 +74,16 @@ export const SettingsPageItemDesktop = (props: SettingsPageItemDesktopProps) =>

return (
<View style={styles.root}>
<View style={styles.header}>
{titleNode}
{descNode}
</View>
{titleNode || descNode
? (
<View style={styles.header}>
{titleNode}
{descNode}
</View>
)
: null
}

<View style={styles.content}>
<ItemComponent />
</View>
Expand Down

0 comments on commit 2f7ee2d

Please sign in to comment.