@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.
- package/README.md +47 -0
- package/dist/index.d.mts +465 -0
- package/dist/index.d.ts +465 -0
- package/dist/index.js +10445 -0
- package/dist/index.mjs +10553 -0
- package/package.json +90 -0
- package/src/components/announcement-modal/AnnouncementModal.tsx +183 -0
- package/src/components/article/Article.tsx +22 -0
- package/src/components/article/ArticleCard.tsx +81 -0
- package/src/components/article/ArticleExcerpts.tsx +80 -0
- package/src/components/article/ArticleList.tsx +114 -0
- package/src/components/article/ArticleMarkdown.tsx +170 -0
- package/src/components/article/ArticleReaderModal.tsx +93 -0
- package/src/components/article/ArticleSingle.tsx +57 -0
- package/src/components/bottom-tab/BottomTab.tsx +392 -0
- package/src/components/button/Button.tsx +154 -0
- package/src/components/challenge/Badges.tsx +84 -0
- package/src/components/challenge/BadgesModal.tsx +166 -0
- package/src/components/challenge/Challenge.tsx +380 -0
- package/src/components/challenge/ChallengeModal.tsx +231 -0
- package/src/components/challenge/ChallengeVignette.tsx +249 -0
- package/src/components/challenge/ChallengesModal.tsx +243 -0
- package/src/components/challenge/QuizModal.tsx +381 -0
- package/src/components/challenge/ResultModal.tsx +144 -0
- package/src/components/chat/Chat.tsx +928 -0
- package/src/components/collection-calendar/CollectionCalendar.tsx +274 -0
- package/src/components/columns/Columns.tsx +34 -0
- package/src/components/consignes-modal/ConsignesModal.tsx +267 -0
- package/src/components/content-inset/ContentInset.tsx +33 -0
- package/src/components/header/Header.tsx +391 -0
- package/src/components/image/Image.tsx +16 -0
- package/src/components/image/ImageFrame.tsx +102 -0
- package/src/components/image/ImageMedia.tsx +31 -0
- package/src/components/image/ImageUrl.tsx +30 -0
- package/src/components/locations-map/LocationSheet.tsx +417 -0
- package/src/components/locations-map/LocationsMap.native.tsx +260 -0
- package/src/components/locations-map/LocationsMap.tsx +13 -0
- package/src/components/locations-map/LocationsMap.web.tsx +10 -0
- package/src/components/locations-map/LocationsMapShell.tsx +527 -0
- package/src/components/locations-map/LocationsMapView.tsx +108 -0
- package/src/components/locations-map/LocationsMapView.web.tsx +331 -0
- package/src/components/nav-button/NavButton.tsx +59 -0
- package/src/components/next-collection/NextCollection.tsx +621 -0
- package/src/components/notifications/NotificationsScreen.tsx +247 -0
- package/src/components/page/Page.tsx +64 -0
- package/src/components/parapraph/Paragraph.tsx +67 -0
- package/src/components/profile/ProfileScreen.tsx +236 -0
- package/src/components/recycling-info/RecyclingInfo.tsx +189 -0
- package/src/components/safe-area/OptionalSafeAreaProvider.tsx +17 -0
- package/src/components/search/Search.tsx +320 -0
- package/src/components/select-street-modal/SelectStreetModal.tsx +475 -0
- package/src/components/title/Title.tsx +100 -0
- package/src/components/vision/Vision.tsx +447 -0
- package/src/components/vision/VisionActionCard.tsx +117 -0
- package/src/components/vision/VisionCapture.tsx +30 -0
- package/src/components/vision/VisionTapOverlay.tsx +122 -0
- package/src/contexts/AnnouncementsContext.tsx +171 -0
- package/src/contexts/ChallengesContext.tsx +182 -0
- package/src/contexts/LocalContext.tsx +227 -0
- package/src/contexts/ThemeContext.tsx +37 -0
- package/src/contexts/WastoContext.tsx +127 -0
- package/src/helpers/blogPost.ts +72 -0
- package/src/helpers/generateQuizQuestions.ts +247 -0
- package/src/helpers/getContrastColor.ts +19 -0
- package/src/helpers/haptics.ts +20 -0
- package/src/helpers/hoursSchedule.ts +230 -0
- package/src/helpers/htmlContentToMarkdown.ts +114 -0
- package/src/helpers/layout.ts +54 -0
- package/src/helpers/loadLinearGradient.ts +22 -0
- package/src/helpers/maquetteTheme.ts +76 -0
- package/src/helpers/markdownUnderlinePlugin.ts +32 -0
- package/src/helpers/normalizeWasteTypeRecyclingInfo.ts +80 -0
- package/src/helpers/publicMediaUrl.ts +8 -0
- package/src/helpers/resolveApiAssetUrl.ts +21 -0
- package/src/helpers/systemRoutes.ts +7 -0
- package/src/helpers/themeStyles.ts +114 -0
- package/src/helpers/useSafeAreaPadding.ts +14 -0
- package/src/hooks/useBadges.ts +100 -0
- package/src/hooks/useBlogPosts.ts +105 -0
- package/src/hooks/useChallenges.ts +110 -0
- package/src/hooks/useCities.ts +56 -0
- package/src/hooks/useCityAnnouncements.ts +118 -0
- package/src/hooks/useCollectionCalendar.ts +421 -0
- package/src/hooks/useColumns.ts +20 -0
- package/src/hooks/useConsignes.ts +62 -0
- package/src/hooks/useLocations.ts +248 -0
- package/src/hooks/useNextCollection.ts +238 -0
- package/src/hooks/useRecyclingInfo.ts +90 -0
- package/src/hooks/useWastoClient.ts +16 -0
- package/src/index.ts +142 -0
- package/src/navigation/NavigationContext.tsx +56 -0
- package/src/sentry/initSentry.ts +120 -0
- package/src/types/Theme.ts +72 -0
- package/src/types/css-modules.d.ts +1 -0
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createElement,
|
|
3
|
+
useEffect,
|
|
4
|
+
useMemo,
|
|
5
|
+
useRef,
|
|
6
|
+
useState,
|
|
7
|
+
} from "react";
|
|
8
|
+
import { StyleSheet, Text, View } from "react-native";
|
|
9
|
+
import type { Map as MapLibreMap, Marker } from "maplibre-gl";
|
|
10
|
+
import {
|
|
11
|
+
LOCATION_CATEGORY_META,
|
|
12
|
+
REUNION_CENTER,
|
|
13
|
+
isValidLatLon,
|
|
14
|
+
type LocationCategory,
|
|
15
|
+
} from "../../hooks/useLocations";
|
|
16
|
+
import { getContrastColor } from "../../helpers/getContrastColor";
|
|
17
|
+
import type { LocationsMapViewProps } from "./LocationsMapView";
|
|
18
|
+
|
|
19
|
+
import "maplibre-gl/dist/maplibre-gl.css";
|
|
20
|
+
|
|
21
|
+
/** Vector style (parity with native). Raster fallback if OpenFreeMap fails (CSP/iframe). */
|
|
22
|
+
const OPENFREEMAP_STYLE = "https://tiles.openfreemap.org/styles/liberty";
|
|
23
|
+
const OSM_RASTER_STYLE = {
|
|
24
|
+
version: 8 as const,
|
|
25
|
+
sources: {
|
|
26
|
+
osm: {
|
|
27
|
+
type: "raster" as const,
|
|
28
|
+
tiles: ["https://tile.openstreetmap.org/{z}/{x}/{y}.png"],
|
|
29
|
+
tileSize: 256,
|
|
30
|
+
attribution: "© OpenStreetMap contributors",
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
layers: [{ id: "osm", type: "raster" as const, source: "osm" }],
|
|
34
|
+
};
|
|
35
|
+
const MAX_MARKERS = 80;
|
|
36
|
+
|
|
37
|
+
/** maplibre-gl@4 dynamic import may be `{ default: ns }` under Metro/webpack. */
|
|
38
|
+
type MapLibreGL = {
|
|
39
|
+
Map: new (options: {
|
|
40
|
+
container: HTMLElement;
|
|
41
|
+
style: string | typeof OSM_RASTER_STYLE;
|
|
42
|
+
center: [number, number];
|
|
43
|
+
zoom: number;
|
|
44
|
+
}) => MapLibreMap;
|
|
45
|
+
Marker: new (options?: { element?: HTMLElement; anchor?: string }) => Marker;
|
|
46
|
+
LngLatBounds: new (
|
|
47
|
+
sw: [number, number],
|
|
48
|
+
ne: [number, number],
|
|
49
|
+
) => { extend: (coord: [number, number]) => unknown };
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
async function loadMapLibre(): Promise<MapLibreGL> {
|
|
53
|
+
const mod = await import("maplibre-gl");
|
|
54
|
+
return ((mod as { default?: MapLibreGL }).default ?? mod) as MapLibreGL;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function buildMarkerElement(category: LocationCategory, selected: boolean) {
|
|
58
|
+
const color =
|
|
59
|
+
LOCATION_CATEGORY_META[category]?.color ??
|
|
60
|
+
LOCATION_CATEGORY_META.recycling.color;
|
|
61
|
+
const iconColor = getContrastColor(color);
|
|
62
|
+
const el = document.createElement("button");
|
|
63
|
+
el.type = "button";
|
|
64
|
+
el.setAttribute("aria-label", LOCATION_CATEGORY_META[category]?.label ?? "Lieu");
|
|
65
|
+
el.style.cssText = [
|
|
66
|
+
"display:flex",
|
|
67
|
+
"align-items:center",
|
|
68
|
+
"justify-content:center",
|
|
69
|
+
"width:32px",
|
|
70
|
+
"height:32px",
|
|
71
|
+
"padding:0",
|
|
72
|
+
"border:none",
|
|
73
|
+
"background:transparent",
|
|
74
|
+
"cursor:pointer",
|
|
75
|
+
].join(";");
|
|
76
|
+
el.innerHTML = `
|
|
77
|
+
<span style="
|
|
78
|
+
display:flex;align-items:center;justify-content:center;
|
|
79
|
+
width:32px;height:32px;border-radius:9999px;
|
|
80
|
+
background:${color};
|
|
81
|
+
border:3px solid ${selected ? "#111827" : "#ffffff"};
|
|
82
|
+
box-shadow:0 1px 3px rgba(0,0,0,0.25);
|
|
83
|
+
transform:scale(${selected ? 1.12 : 1});
|
|
84
|
+
">
|
|
85
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none"
|
|
86
|
+
stroke="${iconColor}" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
|
|
87
|
+
<path d="M20 10c0 6-8 12-8 12s-8-6-8-12a8 8 0 0 1 16 0Z"/>
|
|
88
|
+
<circle cx="12" cy="10" r="3"/>
|
|
89
|
+
</svg>
|
|
90
|
+
</span>
|
|
91
|
+
`;
|
|
92
|
+
return el;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Web MapLibre GL JS canvas (Metro resolves `.web.tsx` over the pin fallback).
|
|
97
|
+
* Same OpenFreeMap style as native + Studio PWA preview.
|
|
98
|
+
*/
|
|
99
|
+
export function LocationsMapView({
|
|
100
|
+
locations,
|
|
101
|
+
center,
|
|
102
|
+
selectedId,
|
|
103
|
+
onSelect,
|
|
104
|
+
}: LocationsMapViewProps) {
|
|
105
|
+
const containerRef = useRef<HTMLDivElement | null>(null);
|
|
106
|
+
const mapRef = useRef<MapLibreMap | null>(null);
|
|
107
|
+
const maplibreRef = useRef<MapLibreGL | null>(null);
|
|
108
|
+
const markersRef = useRef<Array<{ id: string; marker: Marker }>>([]);
|
|
109
|
+
const onSelectRef = useRef(onSelect);
|
|
110
|
+
const [mapReady, setMapReady] = useState(false);
|
|
111
|
+
const [mapError, setMapError] = useState<string | null>(null);
|
|
112
|
+
|
|
113
|
+
const safeCenter = useMemo(() => {
|
|
114
|
+
if (isValidLatLon(center.lat, center.lon)) return center;
|
|
115
|
+
return REUNION_CENTER;
|
|
116
|
+
}, [center]);
|
|
117
|
+
|
|
118
|
+
const validLocations = useMemo(
|
|
119
|
+
() => locations.filter((loc) => isValidLatLon(loc.lat, loc.lon)),
|
|
120
|
+
[locations],
|
|
121
|
+
);
|
|
122
|
+
|
|
123
|
+
useEffect(() => {
|
|
124
|
+
onSelectRef.current = onSelect;
|
|
125
|
+
}, [onSelect]);
|
|
126
|
+
|
|
127
|
+
useEffect(() => {
|
|
128
|
+
let cancelled = false;
|
|
129
|
+
let resizeObserver: ResizeObserver | null = null;
|
|
130
|
+
|
|
131
|
+
async function init() {
|
|
132
|
+
if (!containerRef.current || mapRef.current) return;
|
|
133
|
+
try {
|
|
134
|
+
const maplibregl = await loadMapLibre();
|
|
135
|
+
if (cancelled || !containerRef.current) return;
|
|
136
|
+
maplibreRef.current = maplibregl;
|
|
137
|
+
|
|
138
|
+
const map = new maplibregl.Map({
|
|
139
|
+
container: containerRef.current,
|
|
140
|
+
style: OPENFREEMAP_STYLE,
|
|
141
|
+
center: [safeCenter.lon, safeCenter.lat],
|
|
142
|
+
zoom: 10,
|
|
143
|
+
});
|
|
144
|
+
mapRef.current = map;
|
|
145
|
+
|
|
146
|
+
let usedRasterFallback = false;
|
|
147
|
+
const doResize = () => {
|
|
148
|
+
try {
|
|
149
|
+
map.resize();
|
|
150
|
+
} catch {
|
|
151
|
+
/* ignore */
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
map.on("load", () => {
|
|
156
|
+
doResize();
|
|
157
|
+
requestAnimationFrame(doResize);
|
|
158
|
+
if (!cancelled) {
|
|
159
|
+
setMapError(null);
|
|
160
|
+
setMapReady(true);
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
map.on("error", (e: { error?: { message?: string } }) => {
|
|
165
|
+
const msg =
|
|
166
|
+
typeof e?.error?.message === "string"
|
|
167
|
+
? e.error.message
|
|
168
|
+
: "Erreur chargement carte";
|
|
169
|
+
// OpenFreeMap / vector tiles often blocked in iframe → OSM raster
|
|
170
|
+
if (!usedRasterFallback && !cancelled) {
|
|
171
|
+
usedRasterFallback = true;
|
|
172
|
+
try {
|
|
173
|
+
map.setStyle(OSM_RASTER_STYLE as never);
|
|
174
|
+
return;
|
|
175
|
+
} catch {
|
|
176
|
+
/* fall through */
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
if (!cancelled) setMapError(msg);
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
if (typeof ResizeObserver !== "undefined" && containerRef.current) {
|
|
183
|
+
resizeObserver = new ResizeObserver(() => doResize());
|
|
184
|
+
resizeObserver.observe(containerRef.current);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
requestAnimationFrame(() => {
|
|
188
|
+
doResize();
|
|
189
|
+
setTimeout(doResize, 50);
|
|
190
|
+
setTimeout(doResize, 200);
|
|
191
|
+
});
|
|
192
|
+
} catch (err) {
|
|
193
|
+
if (!cancelled) {
|
|
194
|
+
setMapError(
|
|
195
|
+
err instanceof Error
|
|
196
|
+
? err.message
|
|
197
|
+
: "Impossible de charger MapLibre",
|
|
198
|
+
);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
void init();
|
|
204
|
+
|
|
205
|
+
return () => {
|
|
206
|
+
cancelled = true;
|
|
207
|
+
resizeObserver?.disconnect();
|
|
208
|
+
for (const m of markersRef.current) m.marker.remove();
|
|
209
|
+
markersRef.current = [];
|
|
210
|
+
mapRef.current?.remove();
|
|
211
|
+
mapRef.current = null;
|
|
212
|
+
maplibreRef.current = null;
|
|
213
|
+
setMapReady(false);
|
|
214
|
+
};
|
|
215
|
+
// Init once; center used only as initial camera
|
|
216
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
217
|
+
}, []);
|
|
218
|
+
|
|
219
|
+
useEffect(() => {
|
|
220
|
+
if (!mapReady) return;
|
|
221
|
+
const map = mapRef.current;
|
|
222
|
+
const maplibregl = maplibreRef.current;
|
|
223
|
+
if (!map || !maplibregl) return;
|
|
224
|
+
|
|
225
|
+
for (const m of markersRef.current) m.marker.remove();
|
|
226
|
+
markersRef.current = [];
|
|
227
|
+
|
|
228
|
+
const visible = validLocations.slice(0, MAX_MARKERS);
|
|
229
|
+
for (const loc of visible) {
|
|
230
|
+
const el = buildMarkerElement(
|
|
231
|
+
loc.category as LocationCategory,
|
|
232
|
+
selectedId === loc.id,
|
|
233
|
+
);
|
|
234
|
+
el.addEventListener("click", (e) => {
|
|
235
|
+
e.stopPropagation();
|
|
236
|
+
onSelectRef.current(loc);
|
|
237
|
+
});
|
|
238
|
+
const marker = new maplibregl.Marker({ element: el, anchor: "center" })
|
|
239
|
+
.setLngLat([loc.lon, loc.lat])
|
|
240
|
+
.addTo(map);
|
|
241
|
+
markersRef.current.push({ id: loc.id, marker });
|
|
242
|
+
}
|
|
243
|
+
}, [validLocations, selectedId, mapReady]);
|
|
244
|
+
|
|
245
|
+
const locationsKey = useMemo(
|
|
246
|
+
() => validLocations.map((l) => l.id).join("|"),
|
|
247
|
+
[validLocations],
|
|
248
|
+
);
|
|
249
|
+
|
|
250
|
+
useEffect(() => {
|
|
251
|
+
if (!mapReady) return;
|
|
252
|
+
const map = mapRef.current;
|
|
253
|
+
const maplibregl = maplibreRef.current;
|
|
254
|
+
if (!map || !maplibregl) return;
|
|
255
|
+
|
|
256
|
+
const visible = validLocations.slice(0, MAX_MARKERS);
|
|
257
|
+
if (visible.length === 0) return;
|
|
258
|
+
|
|
259
|
+
if (visible.length === 1) {
|
|
260
|
+
map.easeTo({
|
|
261
|
+
center: [visible[0]!.lon, visible[0]!.lat],
|
|
262
|
+
zoom: 13,
|
|
263
|
+
duration: 350,
|
|
264
|
+
});
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
const bounds = new maplibregl.LngLatBounds(
|
|
269
|
+
[visible[0]!.lon, visible[0]!.lat],
|
|
270
|
+
[visible[0]!.lon, visible[0]!.lat],
|
|
271
|
+
);
|
|
272
|
+
for (const loc of visible) bounds.extend([loc.lon, loc.lat]);
|
|
273
|
+
map.fitBounds(bounds, { padding: 56, maxZoom: 13, duration: 350 });
|
|
274
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- locationsKey captures set
|
|
275
|
+
}, [locationsKey, mapReady]);
|
|
276
|
+
|
|
277
|
+
useEffect(() => {
|
|
278
|
+
if (!mapReady) return;
|
|
279
|
+
const map = mapRef.current;
|
|
280
|
+
if (!map || !selectedId) return;
|
|
281
|
+
const loc = validLocations.find((l) => l.id === selectedId);
|
|
282
|
+
if (!loc) return;
|
|
283
|
+
map.easeTo({
|
|
284
|
+
center: [loc.lon, loc.lat],
|
|
285
|
+
zoom: Math.max(map.getZoom(), 13),
|
|
286
|
+
duration: 350,
|
|
287
|
+
});
|
|
288
|
+
}, [selectedId, validLocations, mapReady]);
|
|
289
|
+
|
|
290
|
+
return (
|
|
291
|
+
<View style={styles.wrap}>
|
|
292
|
+
{createElement("div", {
|
|
293
|
+
ref: containerRef,
|
|
294
|
+
className: "wasto-locations-map",
|
|
295
|
+
style: {
|
|
296
|
+
position: "absolute",
|
|
297
|
+
inset: 0,
|
|
298
|
+
width: "100%",
|
|
299
|
+
height: "100%",
|
|
300
|
+
minHeight: 220,
|
|
301
|
+
},
|
|
302
|
+
})}
|
|
303
|
+
{mapError ? (
|
|
304
|
+
<View style={styles.errorOverlay} pointerEvents="none">
|
|
305
|
+
<Text style={styles.errorText}>Carte indisponible : {mapError}</Text>
|
|
306
|
+
</View>
|
|
307
|
+
) : null}
|
|
308
|
+
</View>
|
|
309
|
+
);
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
const styles = StyleSheet.create({
|
|
313
|
+
wrap: {
|
|
314
|
+
flex: 1,
|
|
315
|
+
minHeight: 220,
|
|
316
|
+
position: "relative",
|
|
317
|
+
overflow: "hidden",
|
|
318
|
+
},
|
|
319
|
+
errorOverlay: {
|
|
320
|
+
...StyleSheet.absoluteFillObject,
|
|
321
|
+
alignItems: "center",
|
|
322
|
+
justifyContent: "center",
|
|
323
|
+
backgroundColor: "rgba(245,245,245,0.92)",
|
|
324
|
+
paddingHorizontal: 16,
|
|
325
|
+
},
|
|
326
|
+
errorText: {
|
|
327
|
+
fontSize: 12,
|
|
328
|
+
textAlign: "center",
|
|
329
|
+
opacity: 0.7,
|
|
330
|
+
},
|
|
331
|
+
});
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import { Pressable, PressableProps, StyleProp, StyleSheet, ViewStyle } from "react-native";
|
|
3
|
+
import { useTheme } from "../../contexts/ThemeContext";
|
|
4
|
+
import { LucideIcon } from "lucide-react-native";
|
|
5
|
+
import { resolveTheme } from "../../helpers/themeStyles";
|
|
6
|
+
import { SPACE } from "../../helpers/layout";
|
|
7
|
+
|
|
8
|
+
export type NavButtonVariant = "default" | "close";
|
|
9
|
+
|
|
10
|
+
export type NavButtonProps = Omit<PressableProps, "children" | "style"> & {
|
|
11
|
+
icon: LucideIcon;
|
|
12
|
+
style?: StyleProp<ViewStyle>;
|
|
13
|
+
variant?: NavButtonVariant;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export function NavButton({
|
|
17
|
+
style,
|
|
18
|
+
icon: Icon,
|
|
19
|
+
variant = "default",
|
|
20
|
+
...props
|
|
21
|
+
}: NavButtonProps): ReactNode {
|
|
22
|
+
const { theme } = useTheme();
|
|
23
|
+
const t = resolveTheme(theme);
|
|
24
|
+
const isClose = variant === "close";
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<Pressable
|
|
28
|
+
style={({ pressed }) => [
|
|
29
|
+
styles.button,
|
|
30
|
+
{
|
|
31
|
+
borderRadius: t.radii.pill,
|
|
32
|
+
backgroundColor: isClose ? t.colors.surface : theme.colors.primary,
|
|
33
|
+
borderWidth: isClose ? 1 : 0,
|
|
34
|
+
borderColor: t.colors.border,
|
|
35
|
+
},
|
|
36
|
+
pressed && styles.pressed,
|
|
37
|
+
style,
|
|
38
|
+
]}
|
|
39
|
+
{...props}
|
|
40
|
+
>
|
|
41
|
+
<Icon
|
|
42
|
+
size={SPACE.iconGlyph}
|
|
43
|
+
color={isClose ? t.colors.onSurface : theme.colors.onPrimary}
|
|
44
|
+
/>
|
|
45
|
+
</Pressable>
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const styles = StyleSheet.create({
|
|
50
|
+
button: {
|
|
51
|
+
width: SPACE.iconHit,
|
|
52
|
+
height: SPACE.iconHit,
|
|
53
|
+
alignItems: "center",
|
|
54
|
+
justifyContent: "center",
|
|
55
|
+
},
|
|
56
|
+
pressed: {
|
|
57
|
+
opacity: 0.85,
|
|
58
|
+
},
|
|
59
|
+
});
|