mirror of
https://github.com/tomru/advcal.git
synced 2026-03-03 06:27:17 +01:00
first working version
This commit is contained in:
27
components/header.js
Normal file
27
components/header.js
Normal file
@@ -0,0 +1,27 @@
|
||||
import React, { useEffect, useState } from "react";
|
||||
|
||||
const Header = () => {
|
||||
const [gifUrl, setGifUrl] = useState(null);
|
||||
useEffect(() => {
|
||||
async function getGif() {
|
||||
const response = await fetch(
|
||||
"//api.giphy.com/v1/gifs/random?tag=christmas&api_key=3ziHSa4ptYJdv2dOuawgzpBhhiW09Ss1"
|
||||
);
|
||||
const { data } = await response.json();
|
||||
setGifUrl(data.image_mp4_url);
|
||||
}
|
||||
|
||||
getGif();
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div className="header">
|
||||
<h1>Bello's Adventskalender 2020</h1>
|
||||
{gifUrl && (
|
||||
<video className="yay-gif-video" src={gifUrl} autoPlay loop muted />
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default Header;
|
||||
Reference in New Issue
Block a user