@wasto/cms-components 1.5.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/README.md +47 -0
  2. package/dist/index.d.mts +465 -0
  3. package/dist/index.d.ts +465 -0
  4. package/dist/index.js +10445 -0
  5. package/dist/index.mjs +10553 -0
  6. package/package.json +90 -0
  7. package/src/components/announcement-modal/AnnouncementModal.tsx +183 -0
  8. package/src/components/article/Article.tsx +22 -0
  9. package/src/components/article/ArticleCard.tsx +81 -0
  10. package/src/components/article/ArticleExcerpts.tsx +80 -0
  11. package/src/components/article/ArticleList.tsx +114 -0
  12. package/src/components/article/ArticleMarkdown.tsx +170 -0
  13. package/src/components/article/ArticleReaderModal.tsx +93 -0
  14. package/src/components/article/ArticleSingle.tsx +57 -0
  15. package/src/components/bottom-tab/BottomTab.tsx +392 -0
  16. package/src/components/button/Button.tsx +154 -0
  17. package/src/components/challenge/Badges.tsx +84 -0
  18. package/src/components/challenge/BadgesModal.tsx +166 -0
  19. package/src/components/challenge/Challenge.tsx +380 -0
  20. package/src/components/challenge/ChallengeModal.tsx +231 -0
  21. package/src/components/challenge/ChallengeVignette.tsx +249 -0
  22. package/src/components/challenge/ChallengesModal.tsx +243 -0
  23. package/src/components/challenge/QuizModal.tsx +381 -0
  24. package/src/components/challenge/ResultModal.tsx +144 -0
  25. package/src/components/chat/Chat.tsx +928 -0
  26. package/src/components/collection-calendar/CollectionCalendar.tsx +274 -0
  27. package/src/components/columns/Columns.tsx +34 -0
  28. package/src/components/consignes-modal/ConsignesModal.tsx +267 -0
  29. package/src/components/content-inset/ContentInset.tsx +33 -0
  30. package/src/components/header/Header.tsx +391 -0
  31. package/src/components/image/Image.tsx +16 -0
  32. package/src/components/image/ImageFrame.tsx +102 -0
  33. package/src/components/image/ImageMedia.tsx +31 -0
  34. package/src/components/image/ImageUrl.tsx +30 -0
  35. package/src/components/locations-map/LocationSheet.tsx +417 -0
  36. package/src/components/locations-map/LocationsMap.native.tsx +260 -0
  37. package/src/components/locations-map/LocationsMap.tsx +13 -0
  38. package/src/components/locations-map/LocationsMap.web.tsx +10 -0
  39. package/src/components/locations-map/LocationsMapShell.tsx +527 -0
  40. package/src/components/locations-map/LocationsMapView.tsx +108 -0
  41. package/src/components/locations-map/LocationsMapView.web.tsx +331 -0
  42. package/src/components/nav-button/NavButton.tsx +59 -0
  43. package/src/components/next-collection/NextCollection.tsx +621 -0
  44. package/src/components/notifications/NotificationsScreen.tsx +247 -0
  45. package/src/components/page/Page.tsx +64 -0
  46. package/src/components/parapraph/Paragraph.tsx +67 -0
  47. package/src/components/profile/ProfileScreen.tsx +236 -0
  48. package/src/components/recycling-info/RecyclingInfo.tsx +189 -0
  49. package/src/components/safe-area/OptionalSafeAreaProvider.tsx +17 -0
  50. package/src/components/search/Search.tsx +320 -0
  51. package/src/components/select-street-modal/SelectStreetModal.tsx +475 -0
  52. package/src/components/title/Title.tsx +100 -0
  53. package/src/components/vision/Vision.tsx +447 -0
  54. package/src/components/vision/VisionActionCard.tsx +117 -0
  55. package/src/components/vision/VisionCapture.tsx +30 -0
  56. package/src/components/vision/VisionTapOverlay.tsx +122 -0
  57. package/src/contexts/AnnouncementsContext.tsx +171 -0
  58. package/src/contexts/ChallengesContext.tsx +182 -0
  59. package/src/contexts/LocalContext.tsx +227 -0
  60. package/src/contexts/ThemeContext.tsx +37 -0
  61. package/src/contexts/WastoContext.tsx +127 -0
  62. package/src/helpers/blogPost.ts +72 -0
  63. package/src/helpers/generateQuizQuestions.ts +247 -0
  64. package/src/helpers/getContrastColor.ts +19 -0
  65. package/src/helpers/haptics.ts +20 -0
  66. package/src/helpers/hoursSchedule.ts +230 -0
  67. package/src/helpers/htmlContentToMarkdown.ts +114 -0
  68. package/src/helpers/layout.ts +54 -0
  69. package/src/helpers/loadLinearGradient.ts +22 -0
  70. package/src/helpers/maquetteTheme.ts +76 -0
  71. package/src/helpers/markdownUnderlinePlugin.ts +32 -0
  72. package/src/helpers/normalizeWasteTypeRecyclingInfo.ts +80 -0
  73. package/src/helpers/publicMediaUrl.ts +8 -0
  74. package/src/helpers/resolveApiAssetUrl.ts +21 -0
  75. package/src/helpers/systemRoutes.ts +7 -0
  76. package/src/helpers/themeStyles.ts +114 -0
  77. package/src/helpers/useSafeAreaPadding.ts +14 -0
  78. package/src/hooks/useBadges.ts +100 -0
  79. package/src/hooks/useBlogPosts.ts +105 -0
  80. package/src/hooks/useChallenges.ts +110 -0
  81. package/src/hooks/useCities.ts +56 -0
  82. package/src/hooks/useCityAnnouncements.ts +118 -0
  83. package/src/hooks/useCollectionCalendar.ts +421 -0
  84. package/src/hooks/useColumns.ts +20 -0
  85. package/src/hooks/useConsignes.ts +62 -0
  86. package/src/hooks/useLocations.ts +248 -0
  87. package/src/hooks/useNextCollection.ts +238 -0
  88. package/src/hooks/useRecyclingInfo.ts +90 -0
  89. package/src/hooks/useWastoClient.ts +16 -0
  90. package/src/index.ts +142 -0
  91. package/src/navigation/NavigationContext.tsx +56 -0
  92. package/src/sentry/initSentry.ts +120 -0
  93. package/src/types/Theme.ts +72 -0
  94. package/src/types/css-modules.d.ts +1 -0
@@ -0,0 +1,475 @@
1
+ import { useCallback, useEffect, useRef, useState, type ReactNode } from "react";
2
+ import {
3
+ ActivityIndicator,
4
+ FlatList,
5
+ KeyboardAvoidingView,
6
+ Modal,
7
+ Platform,
8
+ Pressable,
9
+ StyleSheet,
10
+ Text,
11
+ TextInput,
12
+ View,
13
+ } from "react-native";
14
+ import Animated, { FadeIn, FadeOut } from "react-native-reanimated";
15
+ import { Check, MapPin, Search, X } from "lucide-react-native";
16
+ import type { CalendarPdfSector, StreetSectorMatch } from "@wasto/sdk";
17
+ import { useLocal } from "../../contexts/LocalContext";
18
+ import { useTheme } from "../../contexts/ThemeContext";
19
+ import { useWasto } from "../../contexts/WastoContext";
20
+ import { useWastoClient } from "../../hooks/useWastoClient";
21
+ import { useSafeAreaPadding } from "../../helpers/useSafeAreaPadding";
22
+ import { resolveTheme } from "../../helpers/themeStyles";
23
+ import { hapticLight, hapticSelection } from "../../helpers/haptics";
24
+ import { Button } from "../button/Button";
25
+
26
+ type Step = "search" | "pickSector" | "confirm";
27
+
28
+ type PendingSelection = {
29
+ street: StreetSectorMatch;
30
+ sector: CalendarPdfSector;
31
+ };
32
+
33
+ export default function SelectStreetModal(): ReactNode {
34
+ const { hasPlaceSelected, registerDevice, isLoading } = useLocal();
35
+ const { cityGroupId } = useWasto();
36
+ const { theme } = useTheme();
37
+ const t = resolveTheme(theme);
38
+ const client = useWastoClient();
39
+ const insets = useSafeAreaPadding(["top", "bottom"]);
40
+ const inputRef = useRef<TextInput>(null);
41
+
42
+ const [query, setQuery] = useState("");
43
+ const [results, setResults] = useState<StreetSectorMatch[]>([]);
44
+ const [searching, setSearching] = useState(false);
45
+ const [selectedStreet, setSelectedStreet] = useState<StreetSectorMatch | null>(null);
46
+ const [pending, setPending] = useState<PendingSelection | null>(null);
47
+ const [step, setStep] = useState<Step>("search");
48
+ const [error, setError] = useState<string | null>(null);
49
+
50
+ useEffect(() => {
51
+ if (hasPlaceSelected) return;
52
+ const timer = setTimeout(() => inputRef.current?.focus(), 350);
53
+ return () => clearTimeout(timer);
54
+ }, [hasPlaceSelected, step]);
55
+
56
+ useEffect(() => {
57
+ if (hasPlaceSelected) return;
58
+ const trimmed = query.trim();
59
+ if (trimmed.length < 2 || !cityGroupId) {
60
+ setResults([]);
61
+ setSearching(false);
62
+ return;
63
+ }
64
+
65
+ setSearching(true);
66
+ const handle = setTimeout(async () => {
67
+ try {
68
+ setError(null);
69
+ const res = await client.public.cityGroups.searchStreetSectors(cityGroupId, {
70
+ q: trimmed,
71
+ });
72
+ setResults(res.data ?? []);
73
+ } catch (err) {
74
+ setError(
75
+ err instanceof Error ? err.message : "Impossible de rechercher cette rue",
76
+ );
77
+ setResults([]);
78
+ } finally {
79
+ setSearching(false);
80
+ }
81
+ }, 300);
82
+
83
+ return () => clearTimeout(handle);
84
+ }, [cityGroupId, client.public.cityGroups, hasPlaceSelected, query]);
85
+
86
+ const resetToSearch = useCallback(() => {
87
+ setStep("search");
88
+ setSelectedStreet(null);
89
+ setPending(null);
90
+ setTimeout(() => inputRef.current?.focus(), 100);
91
+ }, []);
92
+
93
+ const onSelectStreet = async (street: StreetSectorMatch) => {
94
+ await hapticSelection();
95
+ setSelectedStreet(street);
96
+ setError(null);
97
+ if ((street.sectors ?? []).length === 0) {
98
+ setError("Aucun secteur de collecte trouvé pour cette rue.");
99
+ }
100
+ };
101
+
102
+ const onContinueFromList = async () => {
103
+ if (!selectedStreet) return;
104
+ const withSectors = (selectedStreet.sectors ?? []).filter(Boolean);
105
+ if (withSectors.length === 0) {
106
+ setError("Aucun secteur de collecte trouvé pour cette rue.");
107
+ return;
108
+ }
109
+ await hapticLight();
110
+ if (withSectors.length === 1) {
111
+ setPending({ street: selectedStreet, sector: withSectors[0]! });
112
+ setStep("confirm");
113
+ return;
114
+ }
115
+ setStep("pickSector");
116
+ };
117
+
118
+ const onSelectSector = async (sector: CalendarPdfSector) => {
119
+ if (!selectedStreet) return;
120
+ await hapticSelection();
121
+ setPending({ street: selectedStreet, sector });
122
+ setStep("confirm");
123
+ };
124
+
125
+ const onConfirm = async () => {
126
+ if (!pending) return;
127
+ await hapticLight();
128
+ await registerDevice(
129
+ pending.sector.cityId || pending.street.cityId,
130
+ pending.sector.id,
131
+ {
132
+ cityName: pending.sector.cityName || pending.street.cityName,
133
+ streetName: pending.street.streetName,
134
+ sectorName: pending.sector.name,
135
+ },
136
+ );
137
+ };
138
+
139
+ const showEmptyHint = query.trim().length < 2 && step === "search";
140
+ const showResults = step === "search" && query.trim().length >= 2;
141
+
142
+ return (
143
+ <Modal visible={!hasPlaceSelected} animationType="fade">
144
+ <KeyboardAvoidingView
145
+ style={[styles.root, { backgroundColor: theme.colors.background }, insets]}
146
+ behavior={Platform.OS === "ios" ? "padding" : undefined}
147
+ >
148
+ {step === "confirm" && pending ? (
149
+ <Animated.View entering={FadeIn.duration(220)} exiting={FadeOut.duration(160)} style={styles.confirmWrap}>
150
+ <View style={styles.confirmCenter}>
151
+ <Text style={[styles.confirmLabel, { color: theme.colors.onBackground }]}>
152
+ Votre zone est :
153
+ </Text>
154
+ <Text style={[styles.confirmZone, { color: theme.colors.onBackground }]}>
155
+ “{pending.sector.name}” à {pending.sector.cityName || pending.street.cityName}
156
+ </Text>
157
+ </View>
158
+ <View style={styles.confirmActions}>
159
+ <Button
160
+ onPress={onConfirm}
161
+ loading={isLoading}
162
+ style={[styles.confirmPrimaryBtn, { borderRadius: t.radii.lg }]}
163
+ >
164
+ Continuer
165
+ </Button>
166
+ <Pressable onPress={resetToSearch} hitSlop={8}>
167
+ <Text style={[styles.link, { color: theme.colors.primary }]}>
168
+ Choisir une autre rue
169
+ </Text>
170
+ </Pressable>
171
+ </View>
172
+ </Animated.View>
173
+ ) : (
174
+ <Animated.View entering={FadeIn.duration(220)} style={styles.searchWrap}>
175
+ <View
176
+ style={[
177
+ styles.searchBar,
178
+ {
179
+ backgroundColor: theme.colors.surface,
180
+ borderColor: theme.colors.border,
181
+ borderRadius: t.radii.lg,
182
+ },
183
+ ]}
184
+ >
185
+ <Search size={18} color={t.colors.muted} />
186
+ <TextInput
187
+ ref={inputRef}
188
+ value={query}
189
+ onChangeText={setQuery}
190
+ placeholder="Rue de Paris, Saint Denis"
191
+ placeholderTextColor={t.colors.muted}
192
+ style={[styles.input, { color: theme.colors.onSurface }]}
193
+ autoFocus
194
+ returnKeyType="search"
195
+ autoCorrect={false}
196
+ autoCapitalize="words"
197
+ />
198
+ {query.length > 0 ? (
199
+ <Pressable
200
+ onPress={() => {
201
+ setQuery("");
202
+ setSelectedStreet(null);
203
+ inputRef.current?.focus();
204
+ }}
205
+ hitSlop={8}
206
+ >
207
+ <X size={16} color={t.colors.muted} />
208
+ </Pressable>
209
+ ) : null}
210
+ </View>
211
+
212
+ {!cityGroupId ? (
213
+ <Text style={[styles.error, { color: theme.colors.error }]}>
214
+ Configuration manquante : cityGroupId requis pour la recherche de rues.
215
+ </Text>
216
+ ) : null}
217
+
218
+ {showEmptyHint ? (
219
+ <View style={styles.hint}>
220
+ <Text style={[styles.hintTitle, { color: theme.colors.onBackground }]}>
221
+ Où habitez-vous ?
222
+ </Text>
223
+ <Text style={[styles.hintSub, { color: t.colors.muted }]}>
224
+ Recherchez le nom de votre rue afin de définir votre secteur de collecte
225
+ </Text>
226
+ </View>
227
+ ) : null}
228
+
229
+ {step === "pickSector" && selectedStreet ? (
230
+ <FlatList
231
+ data={selectedStreet.sectors}
232
+ keyExtractor={(item) => item.id}
233
+ contentContainerStyle={styles.listContent}
234
+ keyboardShouldPersistTaps="handled"
235
+ ListHeaderComponent={
236
+ <Text style={[styles.sectionTitle, { color: t.colors.muted }]}>
237
+ Choisissez votre secteur
238
+ </Text>
239
+ }
240
+ renderItem={({ item }) => (
241
+ <Pressable
242
+ onPress={() => onSelectSector(item)}
243
+ style={[
244
+ styles.row,
245
+ { borderBottomColor: theme.colors.border },
246
+ ]}
247
+ >
248
+ <View style={[styles.pin, { backgroundColor: theme.colors.border }]}>
249
+ <MapPin size={16} color={t.colors.muted} />
250
+ </View>
251
+ <View style={styles.rowText}>
252
+ <Text style={[styles.rowTitle, { color: theme.colors.onSurface }]}>
253
+ {item.name}
254
+ </Text>
255
+ <Text style={[styles.rowSub, { color: t.colors.muted }]}>
256
+ {item.cityName}
257
+ </Text>
258
+ </View>
259
+ </Pressable>
260
+ )}
261
+ />
262
+ ) : null}
263
+
264
+ {showResults ? (
265
+ <>
266
+ {searching ? (
267
+ <ActivityIndicator
268
+ color={theme.colors.primary}
269
+ style={{ marginTop: 16 }}
270
+ />
271
+ ) : null}
272
+ {error ? (
273
+ <Text style={[styles.error, { color: theme.colors.error }]}>{error}</Text>
274
+ ) : null}
275
+ <FlatList
276
+ data={results}
277
+ keyExtractor={(item) => item.streetId}
278
+ keyboardShouldPersistTaps="handled"
279
+ contentContainerStyle={styles.listContent}
280
+ ListEmptyComponent={
281
+ !searching ? (
282
+ <Text style={[styles.empty, { color: t.colors.muted }]}>
283
+ Aucune rue trouvée
284
+ </Text>
285
+ ) : null
286
+ }
287
+ renderItem={({ item }) => {
288
+ const selected = selectedStreet?.streetId === item.streetId;
289
+ return (
290
+ <Pressable
291
+ onPress={() => onSelectStreet(item)}
292
+ style={[
293
+ styles.row,
294
+ {
295
+ borderBottomColor: theme.colors.border,
296
+ backgroundColor: selected
297
+ ? theme.colors.border
298
+ : "transparent",
299
+ },
300
+ ]}
301
+ >
302
+ <View
303
+ style={[
304
+ styles.pin,
305
+ { backgroundColor: theme.colors.border },
306
+ ]}
307
+ >
308
+ <MapPin size={16} color={t.colors.muted} />
309
+ </View>
310
+ <View style={styles.rowText}>
311
+ <Text
312
+ style={[
313
+ styles.rowTitle,
314
+ { color: theme.colors.onSurface },
315
+ ]}
316
+ >
317
+ {item.streetName}
318
+ </Text>
319
+ <Text style={[styles.rowSub, { color: t.colors.muted }]}>
320
+ {item.cityName}
321
+ </Text>
322
+ </View>
323
+ {selected ? (
324
+ <Check size={18} color={theme.colors.onSurface} />
325
+ ) : null}
326
+ </Pressable>
327
+ );
328
+ }}
329
+ />
330
+ {selectedStreet ? (
331
+ <Button
332
+ onPress={onContinueFromList}
333
+ style={[styles.primaryBtn, { borderRadius: t.radii.lg }]}
334
+ >
335
+ Continuer
336
+ </Button>
337
+ ) : null}
338
+ </>
339
+ ) : null}
340
+ </Animated.View>
341
+ )}
342
+ </KeyboardAvoidingView>
343
+ </Modal>
344
+ );
345
+ }
346
+
347
+ const styles = StyleSheet.create({
348
+ root: {
349
+ flex: 1,
350
+ paddingHorizontal: 16,
351
+ paddingTop: 8,
352
+ },
353
+ searchWrap: {
354
+ flex: 1,
355
+ gap: 12,
356
+ },
357
+ searchBar: {
358
+ flexDirection: "row",
359
+ alignItems: "center",
360
+ gap: 10,
361
+ paddingHorizontal: 14,
362
+ height: 48,
363
+ borderWidth: 1,
364
+ },
365
+ input: {
366
+ flex: 1,
367
+ fontSize: 16,
368
+ paddingVertical: 0,
369
+ },
370
+ hint: {
371
+ flex: 1,
372
+ justifyContent: "center",
373
+ alignItems: "center",
374
+ paddingHorizontal: 24,
375
+ gap: 10,
376
+ marginBottom: 80,
377
+ },
378
+ hintTitle: {
379
+ fontSize: 22,
380
+ fontWeight: "800",
381
+ textAlign: "center",
382
+ },
383
+ hintSub: {
384
+ fontSize: 15,
385
+ textAlign: "center",
386
+ lineHeight: 22,
387
+ },
388
+ listContent: {
389
+ paddingBottom: 16,
390
+ },
391
+ sectionTitle: {
392
+ fontSize: 13,
393
+ fontWeight: "600",
394
+ textTransform: "uppercase",
395
+ marginBottom: 8,
396
+ marginTop: 4,
397
+ },
398
+ row: {
399
+ flexDirection: "row",
400
+ alignItems: "center",
401
+ gap: 12,
402
+ paddingVertical: 12,
403
+ paddingHorizontal: 8,
404
+ borderBottomWidth: StyleSheet.hairlineWidth,
405
+ },
406
+ pin: {
407
+ width: 36,
408
+ height: 36,
409
+ borderRadius: 18,
410
+ alignItems: "center",
411
+ justifyContent: "center",
412
+ },
413
+ rowText: {
414
+ flex: 1,
415
+ gap: 2,
416
+ },
417
+ rowTitle: {
418
+ fontSize: 16,
419
+ fontWeight: "700",
420
+ },
421
+ rowSub: {
422
+ fontSize: 13,
423
+ },
424
+ empty: {
425
+ textAlign: "center",
426
+ marginTop: 24,
427
+ },
428
+ error: {
429
+ marginTop: 8,
430
+ fontSize: 13,
431
+ },
432
+ primaryBtn: {
433
+ height: 52,
434
+ marginBottom: 8,
435
+ },
436
+ confirmWrap: {
437
+ flex: 1,
438
+ justifyContent: "space-between",
439
+ paddingBottom: 24,
440
+ },
441
+ confirmCenter: {
442
+ flex: 1,
443
+ justifyContent: "center",
444
+ alignItems: "center",
445
+ gap: 8,
446
+ paddingHorizontal: 24,
447
+ },
448
+ confirmLabel: {
449
+ fontSize: 20,
450
+ fontWeight: "800",
451
+ textAlign: "center",
452
+ },
453
+ confirmZone: {
454
+ fontSize: 22,
455
+ fontWeight: "800",
456
+ textAlign: "center",
457
+ },
458
+ confirmActions: {
459
+ gap: 16,
460
+ alignItems: "stretch",
461
+ width: "100%",
462
+ },
463
+ confirmPrimaryBtn: {
464
+ height: 52,
465
+ width: "100%",
466
+ alignSelf: "stretch",
467
+ },
468
+ link: {
469
+ fontSize: 15,
470
+ fontWeight: "700",
471
+ paddingVertical: 4,
472
+ textAlign: "center",
473
+ alignSelf: "center",
474
+ },
475
+ });
@@ -0,0 +1,100 @@
1
+ import type { ReactNode } from "react";
2
+ import { StyleProp, StyleSheet, Text, TextStyle, View } from "react-native";
3
+ import { useTheme } from "../../contexts/ThemeContext";
4
+ import { Theme } from "../../types/Theme";
5
+
6
+ export type TitleLevel = "1" | "2" | "3";
7
+
8
+ export type TextAlignHorizontal = "left" | "center" | "right";
9
+ export type TextAlignVertical = "top" | "middle" | "bottom";
10
+
11
+ export type TitleProps = {
12
+ text: string;
13
+ level: TitleLevel;
14
+ style?: StyleProp<TextStyle>;
15
+ numberOfLines?: number;
16
+ alignHorizontal?: TextAlignHorizontal;
17
+ alignVertical?: TextAlignVertical;
18
+ };
19
+
20
+ function justifyForVertical(align: TextAlignVertical | undefined): "flex-start" | "center" | "flex-end" {
21
+ if (align === "middle") return "center";
22
+ if (align === "bottom") return "flex-end";
23
+ return "flex-start";
24
+ }
25
+
26
+ function textAlignFor(align: TextAlignHorizontal | undefined): "left" | "center" | "right" {
27
+ if (align === "center" || align === "right") return align;
28
+ return "left";
29
+ }
30
+
31
+ export function Title({
32
+ text,
33
+ level,
34
+ style,
35
+ numberOfLines,
36
+ alignHorizontal,
37
+ alignVertical,
38
+ }: TitleProps): ReactNode {
39
+ const { theme } = useTheme();
40
+ const themedStyles = createThemedStyles(theme);
41
+ const levelStyles = levelsStyles[level];
42
+ const textAlign = textAlignFor(alignHorizontal);
43
+
44
+ const content = (
45
+ <Text
46
+ style={[styles.text, levelStyles.text, themedStyles.text, { textAlign }, style]}
47
+ numberOfLines={numberOfLines}
48
+ >
49
+ {text}
50
+ </Text>
51
+ );
52
+
53
+ if (!alignVertical || alignVertical === "top") {
54
+ return content;
55
+ }
56
+
57
+ return (
58
+ <View style={[styles.alignWrap, { justifyContent: justifyForVertical(alignVertical) }]}>
59
+ {content}
60
+ </View>
61
+ );
62
+ }
63
+
64
+ const createThemedStyles = (theme: Theme) => StyleSheet.create({
65
+ text: {
66
+ color: theme.colors.onBackground,
67
+ }
68
+ });
69
+
70
+ const levelsStyles: Record<TitleLevel, { text: TextStyle }> = {
71
+ "1": StyleSheet.create({
72
+ text: {
73
+ fontSize: 24,
74
+ fontWeight: "700",
75
+ letterSpacing: -0.3,
76
+ },
77
+ }),
78
+ "2": StyleSheet.create({
79
+ text: {
80
+ fontSize: 20,
81
+ fontWeight: "600",
82
+ letterSpacing: -0.2,
83
+ },
84
+ }),
85
+ "3": StyleSheet.create({
86
+ text: {
87
+ fontSize: 16,
88
+ fontWeight: "600",
89
+ letterSpacing: -0.1,
90
+ },
91
+ }),
92
+ };
93
+
94
+ const styles = StyleSheet.create({
95
+ text: {},
96
+ alignWrap: {
97
+ minHeight: 24,
98
+ width: "100%",
99
+ },
100
+ });