Skip to content

Commit a27fc5c

Browse files
committed
refactor(theme): rename Colors/Spacing to AppColors/AppSpacing
1 parent eb9bd05 commit a27fc5c

31 files changed

+178
-214
lines changed

examples/build.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ Build the app with:
103103
- TypeScript with strict mode enabled
104104
- Consistent theme using shared style reference (see Prompt 8.5)
105105
- App name: "OneSignal Demo"
106-
- Top navigation header: centered title with OneSignal logo SVG + "Sample App" text
106+
- Top navigation header: centered title with OneSignal logo SVG + "React Native" text
107107
- Support for both Android and iOS
108108
- Android package name: com.onesignal.example
109109
- iOS bundle identifier: com.onesignal.example
@@ -448,8 +448,8 @@ Send In-App Message Section (placed right after In-App Messaging):
448448

449449
- Section title: "Send In-App Message" with info icon for tooltip
450450
- Four FULL-WIDTH buttons (not a grid):
451-
1. TOP BANNER - icon: arrow-up-bold-box-outline, trigger: "iam_type" = "top_banner"
452-
2. BOTTOM BANNER - icon: arrow-down-bold-box-outline, trigger: "iam_type" = "bottom_banner"
451+
1. TOP BANNER - icon: format-vertical-align-top, trigger: "iam_type" = "top_banner"
452+
2. BOTTOM BANNER - icon: format-vertical-align-bottom, trigger: "iam_type" = "bottom_banner"
453453
3. CENTER MODAL - icon: crop-square, trigger: "iam_type" = "center_modal"
454454
4. FULL SCREEN - icon: fullscreen, trigger: "iam_type" = "full_screen"
455455
- Button styling:

examples/demo/App.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import LogManager from './src/services/LogManager';
2424
import OneSignalApiService from './src/services/OneSignalApiService';
2525
import PreferencesService from './src/services/PreferencesService';
2626
import TooltipHelper from './src/services/TooltipHelper';
27-
import { Colors } from './src/theme';
27+
import { AppColors } from './src/theme';
2828

2929
const Stack = createNativeStackNavigator();
3030
const log = LogManager.getInstance();
@@ -136,15 +136,15 @@ function App() {
136136
return (
137137
<SafeAreaProvider>
138138
<StatusBar
139-
backgroundColor={Colors.oneSignalRed}
139+
backgroundColor={AppColors.osPrimary}
140140
barStyle="light-content"
141141
/>
142142
<AppContextProvider>
143143
<NavigationContainer>
144144
<Stack.Navigator
145145
screenOptions={{
146-
headerStyle: { backgroundColor: Colors.oneSignalRed },
147-
headerTintColor: Colors.white,
146+
headerStyle: { backgroundColor: AppColors.osPrimary },
147+
headerTintColor: AppColors.white,
148148
headerTitleAlign: 'center',
149149
}}
150150
>
@@ -159,7 +159,7 @@ function App() {
159159
width={99}
160160
style={headerStyles.logo}
161161
/>
162-
<Text style={headerStyles.subtitle}>Sample App</Text>
162+
<Text style={headerStyles.subtitle}>React Native</Text>
163163
</View>
164164
),
165165
}}
@@ -188,7 +188,7 @@ const headerStyles = StyleSheet.create({
188188
subtitle: {
189189
fontSize: 14,
190190
fontWeight: '400',
191-
color: Colors.white,
191+
color: AppColors.white,
192192
opacity: 0.9,
193193
},
194194
});

examples/demo/src/components/ActionButton.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
View,
77
ActivityIndicator,
88
} from 'react-native';
9-
import { Colors, Spacing } from '../theme';
9+
import { AppColors, AppSpacing } from '../theme';
1010

1111
interface Props {
1212
label: string;
@@ -33,17 +33,17 @@ export default function ActionButton({
3333
}: Props) {
3434
const bgColor =
3535
variant === 'primary'
36-
? Colors.oneSignalRed
36+
? AppColors.osPrimary
3737
: variant === 'destructive'
38-
? Colors.destructiveRed
38+
? AppColors.osPrimary
3939
: 'transparent';
4040

4141
const borderStyle =
4242
variant === 'outlined'
43-
? { borderWidth: 1, borderColor: Colors.oneSignalRed }
43+
? { borderWidth: 1, borderColor: AppColors.osPrimary }
4444
: {};
4545

46-
const textColor = variant === 'outlined' ? Colors.oneSignalRed : Colors.white;
46+
const textColor = variant === 'outlined' ? AppColors.osPrimary : AppColors.white;
4747

4848
return (
4949
<TouchableOpacity
@@ -81,7 +81,7 @@ const styles = StyleSheet.create({
8181
paddingVertical: 14,
8282
paddingHorizontal: 16,
8383
width: '100%',
84-
marginBottom: Spacing.cardGap,
84+
marginBottom: AppSpacing.gap,
8585
},
8686
inner: {
8787
flexDirection: 'row',

examples/demo/src/components/ListWidgets.tsx

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React, { useState } from 'react';
22
import { View, Text, TouchableOpacity, StyleSheet } from 'react-native';
33
import Icon from 'react-native-vector-icons/MaterialIcons';
4-
import { Colors, AppTheme } from '../theme';
4+
import { AppColors, AppTheme } from '../theme';
55

66
// PairItem
77
interface PairItemProps {
@@ -46,7 +46,7 @@ export function PairItem({
4646
onPress={onDelete}
4747
hitSlop={{ top: 8, bottom: 8, left: 8, right: 8 }}
4848
>
49-
<Icon name="close" size={18} color={Colors.textSecondary} />
49+
<Icon name="close" size={18} color={AppColors.osPrimary} />
5050
</TouchableOpacity>
5151
)}
5252
</View>
@@ -71,7 +71,7 @@ export function SingleItem({ value, onDelete, testID }: SingleItemProps) {
7171
onPress={onDelete}
7272
hitSlop={{ top: 8, bottom: 8, left: 8, right: 8 }}
7373
>
74-
<Icon name="close" size={18} color={Colors.textSecondary} />
74+
<Icon name="close" size={18} color={AppColors.osPrimary} />
7575
</TouchableOpacity>
7676
)}
7777
</View>
@@ -195,28 +195,28 @@ const styles = StyleSheet.create({
195195
},
196196
pairStackedKey: {
197197
fontSize: 15,
198-
color: Colors.textPrimary,
198+
color: AppColors.osGrey700,
199199
fontWeight: '500',
200200
marginBottom: 2,
201201
},
202202
pairStackedValue: {
203203
fontSize: 14,
204-
color: Colors.textSecondary,
204+
color: AppColors.osGrey600,
205205
},
206206
pairKey: {
207207
flex: 1,
208208
fontSize: 14,
209-
color: Colors.textSecondary,
209+
color: AppColors.osGrey600,
210210
},
211211
pairSeparator: {
212212
fontSize: 14,
213-
color: Colors.dividerColor,
213+
color: AppColors.osDivider,
214214
marginHorizontal: 8,
215215
},
216216
pairValue: {
217217
flex: 1,
218218
fontSize: 14,
219-
color: Colors.textPrimary,
219+
color: AppColors.osGrey700,
220220
textAlign: 'right',
221221
marginRight: 8,
222222
},
@@ -228,28 +228,28 @@ const styles = StyleSheet.create({
228228
singleValue: {
229229
flex: 1,
230230
fontSize: 14,
231-
color: Colors.textPrimary,
231+
color: AppColors.osGrey700,
232232
},
233233
emptyContainer: {
234234
paddingVertical: 8,
235235
alignItems: 'center',
236236
},
237237
emptyText: {
238238
fontSize: 14,
239-
color: Colors.textSecondary,
239+
color: AppColors.osGrey600,
240240
fontStyle: 'italic',
241241
},
242242
divider: {
243243
height: 1,
244-
backgroundColor: Colors.dividerColor,
244+
backgroundColor: AppColors.osDivider,
245245
},
246246
moreButton: {
247247
paddingVertical: 8,
248248
alignItems: 'center',
249249
},
250250
moreText: {
251251
fontSize: 13,
252-
color: Colors.oneSignalRed,
252+
color: AppColors.osPrimary,
253253
fontWeight: '500',
254254
},
255255
});

examples/demo/src/components/LoadingOverlay.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
22
import { View, ActivityIndicator, StyleSheet } from 'react-native';
3-
import { Colors } from '../theme';
3+
import { AppColors } from '../theme';
44

55
interface Props {
66
visible: boolean;
@@ -12,15 +12,15 @@ export default function LoadingOverlay({ visible }: Props) {
1212
}
1313
return (
1414
<View style={styles.overlay}>
15-
<ActivityIndicator size="large" color={Colors.oneSignalRed} />
15+
<ActivityIndicator size="large" color={AppColors.osPrimary} />
1616
</View>
1717
);
1818
}
1919

2020
const styles = StyleSheet.create({
2121
overlay: {
2222
...StyleSheet.absoluteFillObject,
23-
backgroundColor: 'rgba(0,0,0,0.3)',
23+
backgroundColor: AppColors.osOverlayScrim,
2424
alignItems: 'center',
2525
justifyContent: 'center',
2626
zIndex: 999,

examples/demo/src/components/LogView.tsx

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@ import {
88
} from 'react-native';
99
import Icon from 'react-native-vector-icons/MaterialIcons';
1010
import LogManager, { LogEntry } from '../services/LogManager';
11+
import { AppColors } from '../theme';
1112

1213
const LEVEL_COLORS: Record<string, string> = {
13-
D: '#9E9E9E',
14-
I: '#64B5F6',
15-
W: '#FFB74D',
16-
E: '#EF5350',
14+
D: AppColors.osLogDebug,
15+
I: AppColors.osLogInfo,
16+
W: AppColors.osLogWarn,
17+
E: AppColors.osLogError,
1718
};
1819

1920
export default function LogView() {
@@ -28,7 +29,6 @@ export default function LogView() {
2829
useEffect(() => {
2930
const unsub = LogManager.getInstance().subscribe(updated => {
3031
setEntries(updated);
31-
// auto-scroll to end
3232
setTimeout(() => {
3333
vertScrollRef.current?.scrollToEnd({ animated: false });
3434
}, 50);
@@ -43,7 +43,6 @@ export default function LogView() {
4343
style={[styles.container, { height: expanded ? 200 : 36 }]}
4444
testID="log_view_container"
4545
>
46-
{/* Header */}
4746
<TouchableOpacity
4847
style={styles.header}
4948
onPress={() => setExpanded(prev => !prev)}
@@ -58,12 +57,12 @@ export default function LogView() {
5857
hitSlop={{ top: 8, bottom: 8, left: 8, right: 8 }}
5958
testID="log_view_clear_button"
6059
>
61-
<Icon name="delete" size={18} color="#9E9E9E" />
60+
<Icon name="delete" size={18} color={AppColors.osGrey500} />
6261
</TouchableOpacity>
6362
<Icon
6463
name={expanded ? 'expand-less' : 'expand-more'}
6564
size={18}
66-
color="#9E9E9E"
65+
color={AppColors.osGrey500}
6766
style={styles.expandIcon}
6867
/>
6968
</View>
@@ -105,7 +104,7 @@ export default function LogView() {
105104
<Text
106105
style={[
107106
styles.level,
108-
{ color: LEVEL_COLORS[entry.level] ?? '#9E9E9E' },
107+
{ color: LEVEL_COLORS[entry.level] ?? AppColors.osGrey500 },
109108
]}
110109
testID={`log_entry_${index}_level`}
111110
>
@@ -131,19 +130,19 @@ export default function LogView() {
131130
const styles = StyleSheet.create({
132131
container: {
133132
width: '100%',
134-
backgroundColor: '#1A1B1E',
133+
backgroundColor: AppColors.osLogBackground,
135134
},
136135
header: {
137136
flexDirection: 'row',
138137
alignItems: 'center',
139138
justifyContent: 'space-between',
140-
paddingHorizontal: 12,
141-
paddingVertical: 6,
139+
paddingHorizontal: 16,
140+
paddingVertical: 12,
142141
},
143142
headerText: {
144143
fontSize: 11,
145-
fontWeight: '600',
146-
color: '#9E9E9E',
144+
fontWeight: '700',
145+
color: AppColors.white,
147146
letterSpacing: 0.8,
148147
},
149148
headerRight: {
@@ -166,7 +165,7 @@ const styles = StyleSheet.create({
166165
},
167166
timestamp: {
168167
fontSize: 11,
169-
color: '#757575',
168+
color: AppColors.osLogTimestamp,
170169
fontFamily: 'monospace',
171170
},
172171
level: {
@@ -176,12 +175,12 @@ const styles = StyleSheet.create({
176175
},
177176
message: {
178177
fontSize: 11,
179-
color: '#E0E0E0',
178+
color: AppColors.white,
180179
fontFamily: 'monospace',
181180
},
182181
emptyText: {
183182
fontSize: 11,
184-
color: '#757575',
183+
color: AppColors.osGrey500,
185184
fontStyle: 'italic',
186185
paddingVertical: 4,
187186
},

examples/demo/src/components/SectionCard.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
22
import { View, Text, TouchableOpacity, StyleSheet } from 'react-native';
3-
import { Colors, AppTheme, Spacing } from '../theme';
3+
import { AppColors, AppTheme, AppSpacing } from '../theme';
44

55
interface Props {
66
title: string;
@@ -36,25 +36,25 @@ export default function SectionCard({
3636
const styles = StyleSheet.create({
3737
wrapper: {
3838
marginHorizontal: 16,
39-
marginBottom: Spacing.sectionGap,
39+
marginBottom: AppSpacing.sectionVertical,
4040
},
4141
header: {
4242
flexDirection: 'row',
4343
alignItems: 'center',
4444
justifyContent: 'space-between',
45-
marginBottom: Spacing.cardGap,
45+
marginBottom: AppSpacing.gap,
4646
paddingHorizontal: 4,
4747
},
4848
title: {
4949
fontSize: 12,
50-
fontWeight: '600',
51-
color: Colors.textSecondary,
52-
letterSpacing: 0.8,
50+
fontWeight: '700',
51+
color: AppColors.osGrey700,
52+
letterSpacing: 0.5,
5353
textTransform: 'uppercase',
5454
},
5555
infoIcon: {
56-
fontSize: 16,
57-
color: Colors.textSecondary,
56+
fontSize: 18,
57+
color: AppColors.osGrey500,
5858
},
5959
card: {
6060
...AppTheme.card,

0 commit comments

Comments
 (0)