From b5b4aa8666a1e487cb5a1932aa944ef20a819c41 Mon Sep 17 00:00:00 2001 From: Brandon Presley Date: Sun, 25 Sep 2022 17:32:49 +1300 Subject: [PATCH] Split out colors --- MassiveFab.tsx | 6 +++++- SettingsPage.tsx | 19 +++++++++---------- colors.ts | 9 +++++++++ input.ts | 5 +++++ 4 files changed, 28 insertions(+), 11 deletions(-) create mode 100644 colors.ts create mode 100644 input.ts diff --git a/MassiveFab.tsx b/MassiveFab.tsx index 5c52524..6bb1bbc 100644 --- a/MassiveFab.tsx +++ b/MassiveFab.tsx @@ -1,17 +1,21 @@ import React, {useContext} from 'react'; import {FAB} from 'react-native-paper'; import {CustomTheme} from './App'; +import {lightColors} from './colors'; export default function MassiveFab( props: Partial>, ) { const {color} = useContext(CustomTheme); + const fabColor = lightColors.map(lightColor => lightColor.hex).includes(color) + ? 'black' + : undefined; return ( { - name: string; - value?: T; - onChange: (value: T) => void; -} - export default function SettingsPage() { const [battery, setBattery] = useState(false); const [ignoring, setIgnoring] = useState(false); @@ -192,10 +188,13 @@ export default function SettingsPage() { dropdownIconColor={color} selectedValue={color} onValueChange={value => setColor(value)}> - - - - + {darkColors.concat(lightColors).map(darkColor => ( + + ))} )} diff --git a/colors.ts b/colors.ts new file mode 100644 index 0000000..a97751f --- /dev/null +++ b/colors.ts @@ -0,0 +1,9 @@ +export const lightColors = [ + {hex: '#B3E5FC', name: 'Cyan'}, + {hex: '#FFC0CB', name: 'Pink'}, +]; + +export const darkColors = [ + {hex: '#8156A7', name: 'Purple'}, + {hex: '#007AFF', name: 'Blue'}, +]; diff --git a/input.ts b/input.ts new file mode 100644 index 0000000..15a2cff --- /dev/null +++ b/input.ts @@ -0,0 +1,5 @@ +export default interface Input { + name: string; + value?: T; + onChange: (value: T) => void; +}