feat: add top-artists report

This commit is contained in:
Julian Tölle 2020-05-31 23:26:06 +02:00
parent 6a6ba493f6
commit 6fc10c40ca
18 changed files with 345 additions and 30 deletions

View file

@ -0,0 +1,31 @@
import { format, parse } from "date-fns";
import React from "react";
const parseDateFromDateInput = (input: string) =>
parse(input, "yyyy-MM-dd", new Date());
const formatDateForDateInput = (date: Date) => format(date, "yyyy-MM-dd");
interface DateSelectProps {
label: string;
value: Date;
onChange: (date: Date) => void;
}
export const DateSelect: React.FC<DateSelectProps> = ({
label,
value,
onChange,
}) => {
return (
<div>
<label className="text-sm">{label}</label>
<input
className="block appearance-none min-w-full md:win-w-0 md:w-1/4 bg-white border border-gray-400 hover:border-gray-500 p-2 rounded shadow leading-tight focus:outline-none focus:shadow-outline"
type="date"
value={formatDateForDateInput(value)}
onChange={(e) => onChange(parseDateFromDateInput(e.target.value))}
/>
</div>
);
};