|
@@ -1,3 +1,5 @@
|
|
|
|
+import { styled } from "@mui/material";
|
|
|
|
+
|
|
interface SlideViewProps {
|
|
interface SlideViewProps {
|
|
/** The URL of the image to show. */
|
|
/** The URL of the image to show. */
|
|
url: string;
|
|
url: string;
|
|
@@ -13,19 +15,9 @@ interface SlideViewProps {
|
|
*/
|
|
*/
|
|
export const SlideView: React.FC<SlideViewProps> = ({ url, nextURL }) => {
|
|
export const SlideView: React.FC<SlideViewProps> = ({ url, nextURL }) => {
|
|
return (
|
|
return (
|
|
- <div
|
|
|
|
|
|
+ <Container
|
|
style={{
|
|
style={{
|
|
- width: "100vw",
|
|
|
|
- height: "100vh",
|
|
|
|
backgroundImage: `url(${url})`,
|
|
backgroundImage: `url(${url})`,
|
|
- backgroundSize: "cover",
|
|
|
|
- backgroundPosition: "center",
|
|
|
|
- backgroundRepeat: "no-repeat",
|
|
|
|
- backgroundBlendMode: "multiply",
|
|
|
|
- backgroundColor: "rgba(0, 0, 0, 0.5)",
|
|
|
|
- // Smooth out the transition a bit.
|
|
|
|
- // Does not work in Firefox.
|
|
|
|
- transition: "background 2s",
|
|
|
|
}}
|
|
}}
|
|
>
|
|
>
|
|
<div
|
|
<div
|
|
@@ -55,6 +47,32 @@ export const SlideView: React.FC<SlideViewProps> = ({ url, nextURL }) => {
|
|
}}
|
|
}}
|
|
/>
|
|
/>
|
|
</div>
|
|
</div>
|
|
- </div>
|
|
|
|
|
|
+ </Container>
|
|
);
|
|
);
|
|
};
|
|
};
|
|
|
|
+
|
|
|
|
+const Container = styled("div")`
|
|
|
|
+ width: 100%;
|
|
|
|
+ height: 100%;
|
|
|
|
+ /* backgroundImage: url({url}), */
|
|
|
|
+ background-size: cover;
|
|
|
|
+ background-position: center;
|
|
|
|
+ background-repeat: no-repeat;
|
|
|
|
+ background-blend-mode: multiply;
|
|
|
|
+ background-color: rgba(0, 0, 0, 0.5);
|
|
|
|
+ /* Smooth out the transition a bit.
|
|
|
|
+ *
|
|
|
|
+ * For the img itself, we set decoding="sync" to have it switch seamlessly.
|
|
|
|
+ * But there does not seem to be a way of setting decoding sync for the
|
|
|
|
+ * background image, and for large (multi-MB) images the background image
|
|
|
|
+ * switch is still visually non-atomic.
|
|
|
|
+ *
|
|
|
|
+ * As a workaround, add a long transition so that the background image
|
|
|
|
+ * transitions in a more "fade-across" manner. This effect might or might
|
|
|
|
+ * not be visually the best though.
|
|
|
|
+ *
|
|
|
|
+ * Does not work in Firefox, but that's fine, this is only a slight tweak,
|
|
|
|
+ * not a functional requirement.
|
|
|
|
+ */
|
|
|
|
+ transition: all 2s;
|
|
|
|
+`;
|