Skip to content

Commit 144831f

Browse files
committed
chore: add theming
1 parent 4765cde commit 144831f

File tree

3 files changed

+65
-24
lines changed

3 files changed

+65
-24
lines changed

package/src/components/ChannelList/Skeleton.tsx

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,8 @@ const SkeletonContent = () => {
4848
export const Skeleton = () => {
4949
const styles = useStyles();
5050

51-
const {
52-
theme: {
53-
channelListSkeleton: { container },
54-
},
55-
} = useTheme();
56-
5751
return (
58-
<View style={[styles.container, container]} testID='channel-preview-skeleton'>
52+
<View style={styles.container} testID='channel-preview-skeleton'>
5953
<View style={styles.content}>
6054
<SkeletonAvatar />
6155
<SkeletonContent />
@@ -68,7 +62,7 @@ Skeleton.displayName = 'Skeleton{channelListSkeleton}';
6862

6963
const useStyles = () => {
7064
const {
71-
theme: { semantics },
65+
theme: { channelListSkeleton, semantics },
7266
} = useTheme();
7367

7468
return useMemo(() => {
@@ -78,48 +72,56 @@ const useStyles = () => {
7872
height: 48,
7973
overflow: 'hidden',
8074
width: 48,
75+
...channelListSkeleton.avatar,
8176
},
8277
badge: {
8378
borderRadius: primitives.radiusMax,
84-
width: 48,
8579
height: 16,
8680
minWidth: 0,
8781
overflow: 'hidden',
82+
width: 48,
83+
...channelListSkeleton.badge,
8884
},
8985
container: {
9086
borderBottomColor: semantics.borderCoreSubtle,
9187
borderBottomWidth: 1,
9288
flexDirection: 'row',
89+
...channelListSkeleton.container,
9390
},
9491
content: {
9592
alignItems: 'center',
9693
flexDirection: 'row',
9794
gap: primitives.spacingMd,
9895
padding: primitives.spacingMd,
9996
width: '100%',
97+
...channelListSkeleton.content,
10098
},
10199
headerRow: {
102100
alignItems: 'center',
103101
flexDirection: 'row',
104102
gap: primitives.spacingMd,
105103
width: '100%',
104+
...channelListSkeleton.headerRow,
106105
},
107106
subtitle: {
108107
borderRadius: primitives.radiusMax,
109108
height: primitives.spacingMd,
110109
overflow: 'hidden',
111110
width: '65%',
111+
...channelListSkeleton.subtitle,
112112
},
113113
textContainer: {
114114
flex: 1,
115115
gap: primitives.spacingXs,
116+
...channelListSkeleton.textContainer,
116117
},
117118
title: {
118119
borderRadius: primitives.radiusMax,
119120
flex: 1,
120121
height: 16,
121122
overflow: 'hidden',
123+
...channelListSkeleton.title,
122124
},
123125
});
124-
}, [semantics.borderCoreSubtle]);
126+
}, [channelListSkeleton, semantics.borderCoreSubtle]);
125127
};

package/src/components/ThreadList/ThreadListItemSkeleton.tsx

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,8 @@ const SkeletonContent = () => {
6060
export const ThreadListItemSkeleton = () => {
6161
const styles = useStyles();
6262

63-
const {
64-
theme: {
65-
threadListSkeleton: { container },
66-
},
67-
} = useTheme();
68-
6963
return (
70-
<View style={[styles.container, container]} testID='channel-preview-skeleton'>
64+
<View style={styles.container} testID='channel-preview-skeleton'>
7165
<View style={styles.content}>
7266
<SkeletonAvatar />
7367
<SkeletonContent />
@@ -81,7 +75,7 @@ ThreadListItemSkeleton.displayName = 'ThreadListItemSkeleton{threadListSkeleton}
8175

8276
const useStyles = () => {
8377
const {
84-
theme: { semantics },
78+
theme: { semantics, threadListSkeleton },
8579
} = useTheme();
8680

8781
return useMemo(() => {
@@ -91,61 +85,72 @@ const useStyles = () => {
9185
height: 48,
9286
overflow: 'hidden',
9387
width: 48,
88+
...threadListSkeleton.avatar,
9489
},
9590
body: {
9691
borderRadius: primitives.radiusMax,
9792
height: 20,
9893
overflow: 'hidden',
94+
...threadListSkeleton.body,
9995
},
10096
container: {
10197
borderBottomColor: semantics.borderCoreSubtle,
10298
borderBottomWidth: 1,
10399
flexDirection: 'row',
100+
...threadListSkeleton.container,
104101
},
105102
content: {
106103
alignItems: 'flex-start',
107104
flexDirection: 'row',
108105
gap: primitives.spacingSm,
109106
padding: primitives.spacingMd,
110107
width: '100%',
108+
...threadListSkeleton.content,
109+
},
110+
contentContainer: {
111+
gap: primitives.spacingXs,
112+
paddingVertical: primitives.spacingXxs,
113+
...threadListSkeleton.contentContainer,
111114
},
112115
footerIcon: {
113116
borderRadius: primitives.radiusMax,
114117
height: 24,
115118
overflow: 'hidden',
116119
width: 24,
120+
...threadListSkeleton.footerIcon,
117121
},
118122
footerPill: {
119123
borderRadius: primitives.radiusMax,
120-
width: 64,
121124
height: 12,
122125
overflow: 'hidden',
126+
width: 64,
127+
...threadListSkeleton.footerPill,
123128
},
124129
footerRow: {
125130
alignItems: 'center',
126131
flexDirection: 'row',
127132
gap: primitives.spacingXs,
133+
...threadListSkeleton.footerRow,
128134
},
129135
headerLabel: {
130136
borderRadius: primitives.radiusMax,
131137
height: 12,
132138
overflow: 'hidden',
133139
width: '40%',
140+
...threadListSkeleton.headerLabel,
134141
},
135142
textContainer: {
136143
flex: 1,
137144
gap: primitives.spacingXs,
138-
},
139-
contentContainer: {
140-
paddingVertical: primitives.spacingXxs,
141-
gap: primitives.spacingXs,
145+
...threadListSkeleton.textContainer,
142146
},
143147
timestamp: {
144148
borderRadius: primitives.radiusMax,
145149
height: 16,
146150
overflow: 'hidden',
147151
width: 48,
152+
...threadListSkeleton.timestamp,
148153
},
149154
});
150-
}, [semantics.borderCoreSubtle]);
155+
}, [semantics.borderCoreSubtle, threadListSkeleton]);
151156
};

package/src/contexts/themeContext/utils/theme.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,11 +183,28 @@ export type Theme = {
183183
};
184184
channelListSkeleton: {
185185
animationTime: number;
186+
avatar: ViewStyle;
187+
badge: ViewStyle;
188+
content: ViewStyle;
186189
container: ViewStyle;
190+
headerRow: ViewStyle;
191+
subtitle: ViewStyle;
192+
textContainer: ViewStyle;
193+
title: ViewStyle;
187194
};
188195
threadListSkeleton: {
189196
animationTime: number;
197+
avatar: ViewStyle;
198+
body: ViewStyle;
199+
content: ViewStyle;
200+
contentContainer: ViewStyle;
190201
container: ViewStyle;
202+
footerIcon: ViewStyle;
203+
footerPill: ViewStyle;
204+
footerRow: ViewStyle;
205+
headerLabel: ViewStyle;
206+
textContainer: ViewStyle;
207+
timestamp: ViewStyle;
191208
};
192209
colors: typeof Colors;
193210
channelPreview: {
@@ -1091,11 +1108,28 @@ export const defaultTheme: Theme = {
10911108
},
10921109
channelListSkeleton: {
10931110
animationTime: 1500, // in milliseconds
1111+
avatar: {},
1112+
badge: {},
1113+
content: {},
10941114
container: {},
1115+
headerRow: {},
1116+
subtitle: {},
1117+
textContainer: {},
1118+
title: {},
10951119
},
10961120
threadListSkeleton: {
10971121
animationTime: 1500, // in milliseconds
1122+
avatar: {},
1123+
body: {},
1124+
content: {},
1125+
contentContainer: {},
10981126
container: {},
1127+
footerIcon: {},
1128+
footerPill: {},
1129+
footerRow: {},
1130+
headerLabel: {},
1131+
textContainer: {},
1132+
timestamp: {},
10991133
},
11001134
channelPreview: {
11011135
container: {},

0 commit comments

Comments
 (0)