Skip to content

Commit 3c75cac

Browse files
committed
style: enhance Embedded component styles and layout for improved usability and visual consistency
1 parent 3b8a98d commit 3c75cac

2 files changed

Lines changed: 94 additions & 32 deletions

File tree

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

Lines changed: 57 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,31 @@ import {
1919
const styles = StyleSheet.create({
2020
button,
2121
buttonText,
22-
container,
22+
compactUtilityButton: {
23+
...button,
24+
paddingVertical: 8,
25+
},
26+
compactUtilityButtonText: {
27+
...buttonText,
28+
fontSize: 12,
29+
lineHeight: 17,
30+
},
31+
container:{
32+
...container,
33+
marginHorizontal: 0,
34+
marginTop: 0,
35+
paddingHorizontal: 0,
36+
},
37+
embeddedHr: {
38+
...hr,
39+
marginVertical: 12,
40+
},
2341
embeddedSection: {
2442
display: 'flex',
2543
flexDirection: 'column',
2644
gap: 16,
2745
paddingHorizontal: 16,
2846
},
29-
hr,
3047
inputContainer: {
3148
marginVertical: 10,
3249
},
@@ -39,6 +56,30 @@ const styles = StyleSheet.create({
3956
modalButtons,
4057
modalContent,
4158
modalOverlay,
59+
placementIdsInput: {
60+
...input,
61+
flex: 1,
62+
marginBottom: 0,
63+
minWidth: 72,
64+
},
65+
placementIdsLabel: {
66+
flexShrink: 1,
67+
fontSize: 14,
68+
},
69+
placementIdsRow: {
70+
alignItems: 'center',
71+
flexDirection: 'row',
72+
gap: 8,
73+
marginBottom: 8,
74+
},
75+
sessionButtonHalf: {
76+
flex: 1,
77+
},
78+
sessionButtonsRow: {
79+
flexDirection: 'row',
80+
gap: 8,
81+
marginBottom: 8,
82+
},
4283
subtitle: { ...subtitle, textAlign: 'center' },
4384
text: { textAlign: 'center' },
4485
textInput: input,
@@ -52,27 +93,37 @@ const styles = StyleSheet.create({
5293
borderRadius: 8,
5394
borderWidth: 2,
5495
flex: 1,
55-
paddingHorizontal: 12,
56-
paddingVertical: 8,
96+
paddingHorizontal: 8,
97+
paddingVertical: 7,
5798
},
5899
viewTypeButtonSelected: {
59100
backgroundColor: colors.brandCyan,
60101
},
61102
viewTypeButtonText: {
62103
color: colors.brandCyan,
63-
fontSize: 14,
104+
fontSize: 12,
64105
fontWeight: '600',
65106
},
66107
viewTypeButtonTextSelected: {
67108
color: colors.backgroundPrimary,
68109
},
69110
viewTypeButtons: {
111+
flex: 1,
70112
flexDirection: 'row',
71113
gap: 8,
72114
justifyContent: 'space-around',
73-
marginTop: 8,
115+
minWidth: 0,
116+
},
117+
viewTypeLabel: {
118+
flexShrink: 0,
119+
fontSize: 13,
120+
fontWeight: '600',
74121
},
75122
viewTypeSelector: {
123+
alignItems: 'center',
124+
flexDirection: 'row',
125+
flexWrap: 'wrap',
126+
gap: 8,
76127
marginVertical: 12,
77128
},
78129
warningContainer: {

example/src/components/Embedded/Embedded.tsx

Lines changed: 37 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ export const Embedded = () => {
8888

8989
return (
9090
<SafeAreaView style={styles.container}>
91-
<Text style={styles.title}>Embedded</Text>
9291
{!Iterable.embeddedManager.isEnabled && (
9392
<View style={styles.warningContainer}>
9493
<Text style={styles.warningText}>
@@ -97,12 +96,9 @@ export const Embedded = () => {
9796
</Text>
9897
</View>
9998
)}
100-
<Text style={styles.subtitle}>
101-
Enter placement IDs to fetch embedded messages
102-
</Text>
10399
<View style={styles.utilitySection}>
104100
<View style={styles.viewTypeSelector}>
105-
<Text style={styles.text}>Select View Type:</Text>
101+
<Text style={styles.viewTypeLabel}>View:</Text>
106102
<View style={styles.viewTypeButtons}>
107103
<TouchableOpacity
108104
style={[
@@ -164,28 +160,43 @@ export const Embedded = () => {
164160
</TouchableOpacity>
165161
</View>
166162
</View>
167-
<TouchableOpacity style={styles.button} onPress={syncEmbeddedMessages}>
168-
<Text style={styles.buttonText}>Sync messages</Text>
169-
</TouchableOpacity>
170-
<TouchableOpacity style={styles.button} onPress={startEmbeddedSession}>
171-
<Text style={styles.buttonText}>Start session</Text>
172-
</TouchableOpacity>
173-
<TouchableOpacity style={styles.button} onPress={endEmbeddedSession}>
174-
<Text style={styles.buttonText}>End session</Text>
175-
</TouchableOpacity>
176-
<TouchableOpacity style={styles.button} onPress={openConfigEditor}>
177-
<Text style={styles.buttonText}>Set view config</Text>
163+
<View style={styles.sessionButtonsRow}>
164+
<TouchableOpacity
165+
style={[styles.compactUtilityButton, styles.sessionButtonHalf]}
166+
onPress={syncEmbeddedMessages}
167+
>
168+
<Text style={styles.compactUtilityButtonText}>Sync</Text>
169+
</TouchableOpacity>
170+
<TouchableOpacity
171+
style={[styles.compactUtilityButton, styles.sessionButtonHalf]}
172+
onPress={startEmbeddedSession}
173+
>
174+
<Text style={styles.compactUtilityButtonText}>Start session</Text>
175+
</TouchableOpacity>
176+
<TouchableOpacity
177+
style={[styles.compactUtilityButton, styles.sessionButtonHalf]}
178+
onPress={endEmbeddedSession}
179+
>
180+
<Text style={styles.compactUtilityButtonText}>End session</Text>
181+
</TouchableOpacity>
182+
</View>
183+
<TouchableOpacity style={styles.compactUtilityButton} onPress={openConfigEditor}>
184+
<Text style={styles.compactUtilityButtonText}>Set view config</Text>
178185
</TouchableOpacity>
179186
<View style={styles.inputContainer}>
180-
<Text style={styles.text}>Placement IDs (comma-separated):</Text>
181-
<TextInput
182-
style={styles.textInput}
183-
placeholder="e.g., 1, 2, 3"
184-
placeholderTextColor="#999"
185-
value={placementIdsInput}
186-
onChangeText={setPlacementIdsInput}
187-
keyboardType="numbers-and-punctuation"
188-
/>
187+
<View style={styles.placementIdsRow}>
188+
<Text style={styles.placementIdsLabel}>
189+
Placement IDs{'\n'}(comma-separated):
190+
</Text>
191+
<TextInput
192+
style={styles.placementIdsInput}
193+
placeholder="e.g., 1, 2, 3"
194+
placeholderTextColor="#999"
195+
value={placementIdsInput}
196+
onChangeText={setPlacementIdsInput}
197+
keyboardType="numbers-and-punctuation"
198+
/>
199+
</View>
189200
<TouchableOpacity style={styles.button} onPress={getEmbeddedMessages}>
190201
<Text style={styles.buttonText}>
191202
Get messages for placement ids
@@ -227,7 +238,7 @@ export const Embedded = () => {
227238
</View>
228239
</View>
229240
</Modal>
230-
<View style={styles.hr} />
241+
<View style={styles.embeddedHr} />
231242
<ScrollView>
232243
<View style={styles.embeddedSection}>
233244
{embeddedMessages.map((message) => (

0 commit comments

Comments
 (0)