Skip to content

Commit 05114b1

Browse files
committed
refactor: extract modal styles into a separate file and update Embedded component styles
1 parent e0c0a24 commit 05114b1

4 files changed

Lines changed: 53 additions & 29 deletions

File tree

example/src/components/Embedded/Embedded.styles.ts

Lines changed: 9 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,13 @@ import {
77
container,
88
hr,
99
input,
10+
modalButton,
11+
modalButtons,
12+
modalContent,
13+
modalOverlay,
1014
subtitle,
1115
title,
12-
utilityColors,
16+
utilityColors
1317
} from '../../constants';
1418

1519
const styles = StyleSheet.create({
@@ -39,33 +43,10 @@ const styles = StyleSheet.create({
3943
marginBottom: 12,
4044
padding: 10,
4145
},
42-
modalButton: {
43-
flex: 1,
44-
},
45-
modalButtons: {
46-
flexDirection: 'row',
47-
gap: 12,
48-
justifyContent: 'flex-end',
49-
},
50-
modalContent: {
51-
backgroundColor: colors.backgroundPrimary,
52-
borderRadius: 12,
53-
maxHeight: '80%',
54-
padding: 16,
55-
},
56-
// eslint-disable-next-line react-native/no-color-literals
57-
modalOverlay: {
58-
backgroundColor: 'rgba(0,0,0,0.5)',
59-
flex: 1,
60-
justifyContent: 'center',
61-
padding: 20,
62-
},
63-
modalTitle: {
64-
fontSize: 18,
65-
fontWeight: '600',
66-
marginBottom: 12,
67-
textAlign: 'center',
68-
},
46+
modalButton,
47+
modalButtons: modalButtons,
48+
modalContent,
49+
modalOverlay,
6950
subtitle: { ...subtitle, textAlign: 'center' },
7051
text: { textAlign: 'center' },
7152
textInput: input,

example/src/components/Embedded/Embedded.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,6 @@ export const Embedded = () => {
204204
>
205205
<View style={styles.modalOverlay}>
206206
<View style={styles.modalContent}>
207-
<Text style={styles.modalTitle}>View config (JSON)</Text>
208207
{configError ? (
209208
<Text style={styles.configError}>{configError}</Text>
210209
) : null}

example/src/constants/styles/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@ export * from './colors';
22
export * from './containers';
33
export * from './formElements';
44
export * from './miscElements';
5+
export * from './modal';
56
export * from './shadows';
67
export * from './typography';
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import type { TextStyle, ViewStyle } from "react-native";
2+
import { colors } from "./colors";
3+
4+
export const modalTitle: TextStyle = {
5+
fontSize: 18,
6+
fontWeight: '600',
7+
marginBottom: 12,
8+
textAlign: 'center',
9+
};
10+
11+
export const modalOverlay: ViewStyle = {
12+
backgroundColor: 'rgba(0,0,0,0.5)',
13+
flex: 1,
14+
justifyContent: 'center',
15+
padding: 20,
16+
};
17+
18+
export const modalContent: ViewStyle = {
19+
backgroundColor: colors.backgroundPrimary,
20+
borderRadius: 12,
21+
maxHeight: '80%',
22+
padding: 16,
23+
};
24+
25+
export const modalButtons: ViewStyle = {
26+
flexDirection: 'row',
27+
gap: 12,
28+
justifyContent: 'flex-end',
29+
};
30+
31+
export const modalButton: ViewStyle = {
32+
flex: 1,
33+
};
34+
35+
export const modalButtonText: TextStyle = {
36+
color: colors.brandCyan,
37+
fontSize: 14,
38+
fontWeight: '600',
39+
};
40+
41+
export const modalButtonTextSelected: TextStyle = {
42+
color: colors.backgroundPrimary,
43+
};

0 commit comments

Comments
 (0)