use jsx extension for react stuff

This commit is contained in:
Thomas Ruoff
2020-11-28 14:12:42 +01:00
parent abc9081da2
commit f6e08255a6
12 changed files with 33 additions and 12 deletions

42
components/calendar.jsx Normal file
View File

@@ -0,0 +1,42 @@
import React, { useContext } from "react";
import AppContext from "../context/app";
const Calendar = () => {
const { loading, songs, openDoor } = useContext(AppContext);
if (loading || !songs) {
return null;
}
return (
<div>
<ul className="cal">
{songs.map((song, index) => {
const classes = ["calcard", song.locked && "calcard__locked"]
.filter(Boolean)
.join(" ");
return (
<li
className={classes}
data-id={index}
key={song.id}
onClick={() => !song.locked && openDoor(index)}
title={
song.locked &&
`Es ist noch nicht der ${new Date(
song.lockedUntil
).toLocaleDateString()}! Geduld, nur Geduld!` || index + 1
}
>
<span className="cardnumber">{index + 1}</span>
</li>
);
})}
</ul>
</div >
);
};
export default Calendar;