tangled
alpha
login
or
join now
stream.place
/
streamplace
Live video on the AT Protocol
74
fork
atom
overview
issues
1
pulls
pipelines
add max width on not desktop
Natalie Bridgers
4 months ago
f5a4c2ec
03649849
+17
-4
1 changed file
expand all
collapse all
unified
split
js
components
src
components
ui
toast.tsx
+17
-4
js/components/src/components/ui/toast.tsx
···
351
const styles: ViewStyle = {
352
position: "absolute",
353
zIndex: 1000,
354
-
width: isDesktop ? 400 : "100%",
355
paddingHorizontal: isDesktop ? 0 : theme.spacing[4],
356
};
0
0
0
0
0
0
0
0
357
358
if (resolvedPosition.includes("top")) {
359
styles.top = insets.top + theme.spacing[4];
···
370
styles.alignItems = "flex-end";
371
}
372
if (resolvedPosition.includes("center")) {
373
-
styles.left = 0;
374
-
styles.right = 0;
375
styles.alignItems = "center";
0
0
0
0
0
0
0
0
376
}
377
378
return styles;
···
790
justifyContent: "space-between",
791
alignItems: "center",
792
padding: theme.spacing[4],
793
-
width: isDesktop ? "100%" : "95%",
794
},
795
variantStyles[variant],
796
]}
···
351
const styles: ViewStyle = {
352
position: "absolute",
353
zIndex: 1000,
0
354
paddingHorizontal: isDesktop ? 0 : theme.spacing[4],
355
};
356
+
357
+
// Set width/maxWidth
358
+
if (isDesktop) {
359
+
styles.width = 400;
360
+
} else {
361
+
styles.width = "100%";
362
+
styles.maxWidth = 400;
363
+
}
364
365
if (resolvedPosition.includes("top")) {
366
styles.top = insets.top + theme.spacing[4];
···
377
styles.alignItems = "flex-end";
378
}
379
if (resolvedPosition.includes("center")) {
0
0
380
styles.alignItems = "center";
381
+
// Center the container itself when it has maxWidth
382
+
if (!isDesktop) {
383
+
styles.left = "50%";
384
+
styles.transform = [{ translateX: "-50%" }];
385
+
} else {
386
+
styles.left = 0;
387
+
styles.right = 0;
388
+
}
389
}
390
391
return styles;
···
803
justifyContent: "space-between",
804
alignItems: "center",
805
padding: theme.spacing[4],
806
+
width: "100%",
807
},
808
variantStyles[variant],
809
]}