mirror of
https://github.com/Steffo99/festa.git
synced 2024-12-22 14:44:21 +00:00
Use background to change image
This commit is contained in:
parent
b5e1138e57
commit
85cea60e04
2 changed files with 9 additions and 7 deletions
|
@ -4,13 +4,13 @@ import { useDefinedContext } from "../utils/definedContext";
|
|||
export function Postcard() {
|
||||
const [postcard, _] = useDefinedContext(PostcardContext)
|
||||
|
||||
const postcardUrl = typeof postcard === "string" ? postcard : postcard.src
|
||||
|
||||
/* eslint-disable @next/next/no-img-element */
|
||||
return (
|
||||
<img
|
||||
return <>
|
||||
<div
|
||||
className="postcard"
|
||||
src={typeof postcard === "string" ? postcard : postcard.src}
|
||||
alt=""
|
||||
draggable={false}
|
||||
style={{backgroundImage: `url(${postcardUrl})`}}
|
||||
/>
|
||||
)
|
||||
</>
|
||||
}
|
|
@ -110,7 +110,9 @@ input.negative, button.negative {
|
|||
.postcard {
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
object-fit: cover;
|
||||
|
||||
background-attachment: fixed;
|
||||
background-size: cover;
|
||||
|
||||
position: absolute;
|
||||
z-index: -1;
|
||||
|
|
Loading…
Reference in a new issue