import React from 'react';
import './Calendar.scss';
import {Day, decadeNames, frJDN, jdnGregorian, jdnLongCount, Month} from './dates';
type MonthProps = {
year: number;
month: Month;
};
type DateProps = MonthProps & {
day: Day;
};
export type CalendarProps = DateProps & {
year: number;
month: Month;
todayJDN: number;
onSwitch?: (year: number, month: Month, day: Day) => void,
};
type CalendarState = {};
function DecadeName({name}: { name: string }): JSX.Element {
return
{name}
;
}
function DayDetail({jdn}: { jdn: number }): JSX.Element {
return
{jdnGregorian(jdn).toDateString()}
{jdnLongCount(jdn)}
;
}
function NormalDay({year, month, day, todayJDN}: DateProps & { todayJDN: number }): JSX.Element {
const jdn = frJDN(year, month, day);
console.log(year, month, day, jdn, todayJDN);
return
{day}
{decadeNames[(day - 1) % 10]}
;
}
function NormalMonth({year, month, todayJDN}: MonthProps & { todayJDN: number }): JSX.Element {
const decadeHeads = decadeNames.map(name => );
return
{decadeHeads}
{
Array.from(Array(3).keys()).map(i =>
{
Array.from(Array(10).keys()).map(j => <>
{j === 4 && }
>)
})
}
;
}
export class Calendar extends React.Component {
render(): JSX.Element {
return ;
}
}