From 71563985c0afd095358884bac5a4ca425b567c9f Mon Sep 17 00:00:00 2001 From: austinried <4966622+austinried@users.noreply.github.com> Date: Sat, 19 Jun 2021 21:48:55 +0900 Subject: [PATCH] refactored colors and text styles --- src/components/FocusableIcon.tsx | 4 ++-- src/components/common/BottomTabBar.tsx | 10 ++++---- src/components/common/TopTabBar.tsx | 28 ++++++++++------------- src/components/common/TopTabContainer.tsx | 7 +++--- src/components/library/ArtistsTab.tsx | 6 ++--- src/styles/colors.ts | 16 +++++++++---- src/styles/text.ts | 21 ++++++++--------- 7 files changed, 44 insertions(+), 48 deletions(-) diff --git a/src/components/FocusableIcon.tsx b/src/components/FocusableIcon.tsx index b7365ad..9705e5e 100644 --- a/src/components/FocusableIcon.tsx +++ b/src/components/FocusableIcon.tsx @@ -1,6 +1,6 @@ import React from 'react'; import { Image, ImageSourcePropType } from 'react-native'; -import { primary } from '../styles/colors'; +import colors from '../styles/colors'; export type FocusableIconProps = { focused: boolean, @@ -20,7 +20,7 @@ const FocusableIcon: React.FC = (props) => { style={{ height: props.height, width: props.width, - tintColor: props.focused ? primary.focused : primary.blurred, + tintColor: props.focused ? colors.text.primary : colors.text.secondary, }} source={props.focused ? props.focusedSource : props.source} /> diff --git a/src/components/common/BottomTabBar.tsx b/src/components/common/BottomTabBar.tsx index 352c968..417e526 100644 --- a/src/components/common/BottomTabBar.tsx +++ b/src/components/common/BottomTabBar.tsx @@ -2,6 +2,7 @@ import React from 'react'; import { Text, View, Image, Pressable } from 'react-native'; import { BottomTabBarProps } from '@react-navigation/bottom-tabs'; import textStyles from '../../styles/text'; +import colors from '../../styles/colors'; const icons: {[key: string]: any} = { home: { @@ -26,7 +27,7 @@ const BottomTabBar: React.FC = ({ state, descriptors, navigat return ( = ({ state, descriptors, navigat style={{ height: 24, width: 24, - tintColor: isFocused ? 'white' : '#a0a0a0', + tintColor: isFocused ? colors.text.primary : colors.text.secondary, }} /> - {label} diff --git a/src/components/common/TopTabBar.tsx b/src/components/common/TopTabBar.tsx index a63c4d2..5f0e105 100644 --- a/src/components/common/TopTabBar.tsx +++ b/src/components/common/TopTabBar.tsx @@ -1,17 +1,16 @@ import React from 'react'; import { Text, View } from 'react-native'; import { MaterialTopTabBarProps } from '@react-navigation/material-top-tabs'; -import { primary } from '../../styles/colors'; -import text from '../../styles/text'; +import colors from '../../styles/colors'; +import textStyles from '../../styles/text'; const TopTabBar: React.FC = ({ state, descriptors }) => { return ( {state.routes.map((route, index) => { const { options } = descriptors[route.key]; @@ -23,24 +22,21 @@ const TopTabBar: React.FC = ({ state, descriptors }) => : route.name; const isFocused = state.index === index; - const fontFamily = isFocused ? 'Ubuntu-Regular' : 'Ubuntu-Light'; - const color = isFocused ? primary.focused : primary.blurred; - const borderBottomColor = isFocused ? primary.focused : '#383838'; + const color = isFocused ? colors.text.primary : colors.text.secondary; + const borderBottomColor = isFocused ? colors.accent : colors.gradient.high; return ( - {label} ); diff --git a/src/components/common/TopTabContainer.tsx b/src/components/common/TopTabContainer.tsx index 21e7719..efb260d 100644 --- a/src/components/common/TopTabContainer.tsx +++ b/src/components/common/TopTabContainer.tsx @@ -1,12 +1,11 @@ import React from 'react'; import LinearGradient from 'react-native-linear-gradient'; +import colors from '../../styles/colors'; const TopTabContainer: React.FC<{}> = ({ children }) => ( = ({ item }) => ( @@ -19,11 +18,10 @@ const ArtistItem: React.FC<{ item: Artist } > = ({ item }) => ( style={{ width: 56, height: 56, - // tintColor: 'white', }} /> {item.name} diff --git a/src/styles/colors.ts b/src/styles/colors.ts index a8c2b1b..c660fad 100644 --- a/src/styles/colors.ts +++ b/src/styles/colors.ts @@ -1,6 +1,12 @@ -import { StyleSheet } from "react-native"; - -export const primary = { - focused: '#fff', - blurred: '#bababa', +export default { + text: { + primary: '#ffffff', + secondary: '#999999', + }, + gradient: { + high: '#2d2d2d', + mid: '#191919', + low: '#000000', + }, + accent: '#c260e5', } diff --git a/src/styles/text.ts b/src/styles/text.ts index 76266f9..e6e3d01 100644 --- a/src/styles/text.ts +++ b/src/styles/text.ts @@ -1,27 +1,24 @@ -import { StyleSheet, TextStyle } from "react-native"; +import { TextStyle } from "react-native"; +import colors from './colors'; -const regular: TextStyle = { +const paragraph: TextStyle = { fontFamily: 'Ubuntu-Light', - fontSize: 18, - color: '#fff', + fontSize: 16, + color: colors.text.primary, }; const header: TextStyle = { - ...regular, - fontSize: 22, + ...paragraph, + fontSize: 18, }; const small: TextStyle = { - ...regular, + ...paragraph, fontSize: 11, }; -export type TextStyles = { - [key: string]: TextStyle, -} - export default { - regular, + paragraph, header, small, };