Skip to content

Commit 594a6eb

Browse files
Mobile: Fixes #13437: Fix conflicts notebook has low contrast when selected
1 parent 5e0829d commit 594a6eb

File tree

5 files changed

+23
-6
lines changed

5 files changed

+23
-6
lines changed

packages/app-mobile/components/side-menu-content.tsx

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,6 @@ const useStyles = (themeId: number) => {
117117
sidebarIcon: sidebarIconStyle,
118118
folderButton: folderButtonStyle,
119119
folderButtonText: folderButtonTextStyle,
120-
conflictFolderButtonText: {
121-
...folderButtonTextStyle,
122-
color: theme.colorError,
123-
},
124120
folderButtonSelected: {
125121
...folderButtonStyle,
126122
backgroundColor: theme.selectedColor,
@@ -197,6 +193,12 @@ const FolderItem: React.FC<FolderItemProps> = props => {
197193
paddingRight: 10,
198194
backgroundColor: props.selected ? theme.selectedColor : undefined,
199195
},
196+
conflictFolderButtonText: {
197+
color: theme.colorError,
198+
},
199+
conflictFolderButtonSelectedText: {
200+
color: theme.colorErrorSelected,
201+
},
200202
});
201203
}, [props.selected, props.depth, props.themeId]);
202204
const baseStyles = props.styles;
@@ -268,7 +270,18 @@ const FolderItem: React.FC<FolderItemProps> = props => {
268270
// depth is specified with an accessibilityLabel:
269271
const folderDepthDescription = props.depth > 0 ? _('(level %d)', props.depth) : '';
270272
const accessibilityLabel = `${folderTitle} ${folderDepthDescription}`.trim();
271-
const folderButtonTextStyle = props.folder.id === Folder.conflictFolderId() ? baseStyles.conflictFolderButtonText : baseStyles.folderButtonText;
273+
const isConflictFolder = props.folder.id === Folder.conflictFolderId();
274+
const textStyle = useMemo(() => {
275+
const result: TextStyle[] = [baseStyles.folderButtonText];
276+
if (isConflictFolder) {
277+
result.push(styles.conflictFolderButtonText);
278+
if (props.selected) {
279+
result.push(styles.conflictFolderButtonSelectedText);
280+
}
281+
}
282+
return result;
283+
}, [styles, props.selected, isConflictFolder, baseStyles.folderButtonText]);
284+
272285
return (
273286
<View key={props.folder.id} style={styles.buttonWrapper}>
274287
<TouchableRipple
@@ -284,7 +297,7 @@ const FolderItem: React.FC<FolderItemProps> = props => {
284297
{renderFolderIcon(props.folder.id, folderIcon)}
285298
<Text
286299
numberOfLines={1}
287-
style={folderButtonTextStyle}
300+
style={textStyle}
288301
accessibilityLabel={accessibilityLabel}
289302
>
290303
{folderTitle}

packages/lib/services/style/themeToCss.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const input: Theme = {
1111
oddBackgroundColor: '#eeeeee',
1212
color: '#32373F', // For regular text
1313
colorError: 'red',
14+
colorErrorSelected: '#d00000',
1415
colorCorrect: 'green',
1516
colorWarn: 'rgb(228,86,0)',
1617
colorWarnUrl: '#155BDA',

packages/lib/themes/dark.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ const theme: Theme = {
2121
dividerColor: '#555555',
2222
selectedColor: '#616161',
2323
urlColor: 'rgb(166,166,255)',
24+
colorErrorSelected: '#FFD7D7',
2425

2526
// Color scheme "2" is used for the sidebar. It's white text over
2627
// dark blue background.

packages/lib/themes/light.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const theme: Theme = {
1818
dividerColor: '#dddddd',
1919
selectedColor: '#e5e5e5',
2020
urlColor: '#155BDA',
21+
colorErrorSelected: '#d00000',
2122

2223
// Color scheme "2" is used for the sidebar. It's white text over
2324
// dark blue background.

packages/lib/themes/type.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export interface Theme {
1313
oddBackgroundColor: string;
1414
color: string; // For regular text
1515
colorError: string;
16+
colorErrorSelected: string; // On a selectedColor background
1617
colorCorrect: string;
1718
colorWarn: string;
1819
colorWarnUrl: string; // For URL displayed over a warningBackgroundColor

0 commit comments

Comments
 (0)