Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature(theme) update new theme colors #3230

Merged
merged 19 commits into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions apps/wallet-mobile/.storybook/storybook.requires.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 16 additions & 2 deletions apps/wallet-mobile/src/Catalyst/InsufficientFundsModal.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {useTheme} from '@yoroi/theme'
import * as React from 'react'
import {useIntl} from 'react-intl'
import {Text, View} from 'react-native'
import {StyleSheet, Text, View} from 'react-native'

import {StandardModal} from '../components'
import {useSelectedWallet} from '../features/WalletManager/Context'
Expand All @@ -12,6 +13,7 @@ import {Amounts, asQuantity} from '../yoroi-wallets/utils'

export const InsufficientFundsModal = ({visible, onRequestClose}: {visible: boolean; onRequestClose: () => void}) => {
const strings = useStrings()
const styles = useStyles()
const wallet = useSelectedWallet()
const balances = useBalances(wallet)

Expand All @@ -27,7 +29,7 @@ export const InsufficientFundsModal = ({visible, onRequestClose}: {visible: bool
showCloseIcon
>
<View>
<Text>
<Text style={styles.text}>
{strings.insufficientBalance({
requiredBalance: formatTokenWithText(asQuantity(CATALYST.DISPLAYED_MIN_ADA), wallet.primaryToken),
currentBalance: formatTokenWithText(
Expand All @@ -54,3 +56,15 @@ const useStrings = () => {
back: intl.formatMessage(confirmationMessages.commonButtons.backButton),
}
}

const useStyles = () => {
const {color} = useTheme()

const styles = StyleSheet.create({
text: {
color: color.gray_cmax,
},
})

return styles
}
2 changes: 1 addition & 1 deletion apps/wallet-mobile/src/Dashboard/EpochProgress.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ const useStyles = () => {
timeBlock: {
...atoms.body_1_lg_regular,
...atoms.py_xs,
backgroundColor: color.gray_c900,
backgroundColor: color.gray_cmin,
color: color.gray_c900,
marginHorizontal: 4,
borderRadius: 2,
Expand Down
49 changes: 26 additions & 23 deletions apps/wallet-mobile/src/Legal/PrivacyPolicy/PrivacyPolicy.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import {useTheme} from '@yoroi/theme'
import React from 'react'
import {ActivityIndicator, StyleSheet, View} from 'react-native'
import Markdown from 'react-native-markdown-display'
Expand All @@ -18,6 +19,7 @@ export const usePrivacyPolicy = ({languageCode}: {languageCode: LanguageCode}) =

export const PrivacyPolicy = ({languageCode}: {languageCode: LanguageCode}) => {
const privacyPolicy = usePrivacyPolicy({languageCode})
const styles = useStyles()

return privacyPolicy != null ? (
<View>
Expand All @@ -31,26 +33,27 @@ export const PrivacyPolicy = ({languageCode}: {languageCode: LanguageCode}) => {
)
}

const styles = StyleSheet.create({
body: {
fontFamily: 'Rubik-Regular',
fontSize: 16,
lineHeight: 24,
color: '#000000',
paddingVertical: 8,
},
heading2: {
fontFamily: 'Rubik-Medium',
lineHeight: 24,
fontSize: 16,
color: '#000000',
paddingVertical: 8,
},
heading1: {
fontFamily: 'Rubik-Bold',
fontSize: 20,
lineHeight: 30,
color: '#000000',
paddingVertical: 10,
},
})
const useStyles = () => {
const {atoms, color} = useTheme()
const styles = StyleSheet.create({
body: {
...atoms.body_1_lg_regular,
...atoms.py_sm,
color: color.gray_cmax,
},
heading2: {
...atoms.body_1_lg_medium,
...atoms.py_sm,
color: color.gray_cmax,
},
heading1: {
fontFamily: 'Rubik-Bold',
fontSize: 20,
lineHeight: 30,
color: color.gray_cmax,
paddingVertical: 10,
},
})

return styles
}
49 changes: 26 additions & 23 deletions apps/wallet-mobile/src/Legal/TermsOfService/TermsOfService.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import {useTheme} from '@yoroi/theme'
import React from 'react'
import {ActivityIndicator, StyleSheet, View} from 'react-native'
import Markdown from 'react-native-markdown-display'
Expand All @@ -18,6 +19,7 @@ export const useTos = ({languageCode}: {languageCode: LanguageCode}) => {

export const TermsOfService = ({languageCode}: {languageCode: LanguageCode}) => {
const tos = useTos({languageCode})
const styles = useStyles()

return tos != null ? (
<View>
Expand All @@ -31,26 +33,27 @@ export const TermsOfService = ({languageCode}: {languageCode: LanguageCode}) =>
)
}

const styles = StyleSheet.create({
body: {
fontFamily: 'Rubik-Regular',
fontSize: 16,
lineHeight: 24,
color: '#000000',
paddingVertical: 8,
},
heading2: {
fontFamily: 'Rubik-Medium',
lineHeight: 24,
fontSize: 16,
color: '#000000',
paddingVertical: 8,
},
heading1: {
fontFamily: 'Rubik-Bold',
fontSize: 20,
lineHeight: 30,
color: '#000000',
paddingVertical: 10,
},
})
const useStyles = () => {
const {atoms, color} = useTheme()
const styles = StyleSheet.create({
body: {
...atoms.body_1_lg_regular,
...atoms.py_sm,
color: color.gray_cmax,
},
heading2: {
...atoms.body_1_lg_medium,
...atoms.py_sm,
color: color.gray_cmax,
},
heading1: {
fontFamily: 'Rubik-Bold',
fontSize: 20,
lineHeight: 30,
color: color.gray_cmax,
paddingVertical: 10,
},
})

return styles
}
2 changes: 2 additions & 0 deletions apps/wallet-mobile/src/NftDetails/NftDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ const useStyles = () => {
},
container: {
flex: 1,
backgroundColor: color.gray_cmin,
},
image: {
flexGrow: 1,
Expand Down Expand Up @@ -292,6 +293,7 @@ const useStyles = () => {
},
title: {
...atoms.body_1_lg_medium,
color: color.text_gray_normal,
},
name: {
color: color.gray_c600,
Expand Down
18 changes: 12 additions & 6 deletions apps/wallet-mobile/src/Search/SearchContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ type Props = {
}
const InputSearch = ({placeholder}: Props) => {
const {search, searchChanged} = useSearch()
const {color} = useTheme()

return (
<TextInput
Expand All @@ -215,17 +216,22 @@ const InputSearch = ({placeholder}: Props) => {
placeholder={placeholder}
onChangeText={(search) => searchChanged(search)}
autoCapitalize="none"
style={{flex: 1, color: '#000000'}}
style={{flex: 1, color: color.el_gray_high}}
testID="inputSearch"
placeholderTextColor={color.text_gray_medium}
/>
)
}

const SearchButton = (props: TouchableOpacityProps) => (
<TouchableOpacity testID="iconSearch" {...props}>
<Icon.Magnify size={26} />
</TouchableOpacity>
)
const SearchButton = (props: TouchableOpacityProps) => {
const {color} = useTheme()

return (
<TouchableOpacity testID="iconSearch" {...props}>
<Icon.Magnify size={26} color={color.text_gray_normal} />
</TouchableOpacity>
)
}

const EraseButton = (props: TouchableOpacityProps) => (
<TouchableOpacity {...props}>
Expand Down
1 change: 1 addition & 0 deletions apps/wallet-mobile/src/TxHistory/TxDetails/TxDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,7 @@ const useStyles = () => {
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: color.gray_cmin,
},
contentContainer: {
...atoms.px_lg,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ type Props = {

export const TxHistoryListItem = ({transaction}: Props) => {
const strings = useStrings()
const {styles, colors} = useStyles()
const {styles, colors, isDark} = useStyles()
const navigation = useNavigation<TxHistoryRouteNavigation>()

const wallet = useSelectedWallet()
Expand Down Expand Up @@ -66,7 +66,7 @@ export const TxHistoryListItem = ({transaction}: Props) => {
onPress={showDetails}
activeOpacity={0.5}
testID="txHistoryListItem"
style={[styles.item, {backgroundColor: rootBgColor}]}
style={[styles.item, {backgroundColor: isDark ? colors.background : rootBgColor}]}
>
<Left>
<Icon.Direction transaction={transaction} />
Expand Down Expand Up @@ -134,7 +134,7 @@ const Amount = ({wallet, transaction}: {wallet: YoroiWallet; transaction: Transa
}

const useStyles = () => {
const {color, atoms} = useTheme()
const {color, atoms, isDark} = useTheme()
const styles = StyleSheet.create({
item: {
flex: 1,
Expand Down Expand Up @@ -166,8 +166,9 @@ const useStyles = () => {
const colors = {
default: color.white_static,
failed: color.primary_c200,
background: color.gray_cmin,
}
return {styles, colors}
return {styles, colors, isDark}
}

const messages = defineMessages({
Expand Down
3 changes: 2 additions & 1 deletion apps/wallet-mobile/src/TxHistory/TxHistoryNavigator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -550,9 +550,10 @@ const useStrings = () => {
}

const SettingsIconButton = (props: TouchableOpacityProps) => {
const {color} = useTheme()
return (
<TouchableOpacity {...props}>
<Icon.Settings size={30} color={COLORS.BLACK} />
<Icon.Settings size={30} color={color.gray_cmax} />
</TouchableOpacity>
)
}
Expand Down
14 changes: 11 additions & 3 deletions apps/wallet-mobile/src/WalletNavigator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ const WalletTabNavigator = () => {
tabBarActiveTintColor: colors.active,
tabBarInactiveTintColor: colors.inactive,
tabBarStyle: {
backgroundColor: colors.background,
// keyboardWillShow keyboardWillHiden dont work on android
display: isKeyboardOpen ? 'none' : undefined,
},
Expand All @@ -90,7 +91,10 @@ const WalletTabNavigator = () => {
tabBarIcon: ({focused}) => <Icon.TabWallet size={24} color={focused ? colors.active : colors.inactive} />,
tabBarLabel: strings.walletTabBarLabel,
tabBarTestID: 'walletTabBarButton',
tabBarStyle: hideTabBarForRoutes(route),
tabBarStyle: {
...hideTabBarForRoutes(route),
backgroundColor: colors.background,
},
})}
>
{() => (
Expand Down Expand Up @@ -122,7 +126,10 @@ const WalletTabNavigator = () => {
tabBarIcon: ({focused}) => <Icon.Discover size={28} color={focused ? colors.active : colors.inactive} />,
tabBarLabel: strings.discoverTabBarLabel,
tabBarTestID: 'discoverTabBarButton',
tabBarStyle: hideTabBarForRoutes(route),
tabBarStyle: {
...hideTabBarForRoutes(route),
backgroundColor: colors.background,
},
})}
>
{() => (
Expand Down Expand Up @@ -236,8 +243,9 @@ const useStyles = () => {
const {color} = useTheme()

const colors = {
active: color.primary_c600,
active: color.text_gray_normal,
inactive: color.gray_c600,
background: color.gray_cmin,
}
return {colors}
}
Expand Down
2 changes: 2 additions & 0 deletions apps/wallet-mobile/src/YoroiApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ export const YoroiApp = () => {

const themeStorage = useThemeStorageMaker()

console.log('themeStorage READ', themeStorage.read())
stackchain marked this conversation as resolved.
Show resolved Hide resolved

if (!migrated) return null

return (
Expand Down
Binary file removed apps/wallet-mobile/src/assets/img/backspace.png
Binary file not shown.
Binary file removed apps/wallet-mobile/src/assets/img/backspace@2x.png
Binary file not shown.
Binary file removed apps/wallet-mobile/src/assets/img/backspace@3x.png
Binary file not shown.
Loading
Loading