Fix calendar CSS for Firefox.

This commit is contained in:
Mike Cao 2020-09-16 16:43:13 -07:00
parent 60b17363e1
commit 30bca80dac
2 changed files with 88 additions and 66 deletions

View File

@ -70,6 +70,7 @@ export default function Calendar({ date, minDate, maxDate, onChange }) {
<Icon className={styles.icon} icon={selectYear ? <Cross /> : <Chevron />} size="small" /> <Icon className={styles.icon} icon={selectYear ? <Cross /> : <Chevron />} size="small" />
</div> </div>
</div> </div>
<div className={styles.body}>
{!selectMonth && !selectYear && ( {!selectMonth && !selectYear && (
<DaySelector <DaySelector
date={date} date={date}
@ -99,6 +100,7 @@ export default function Calendar({ date, minDate, maxDate, onChange }) {
/> />
)} )}
</div> </div>
</div>
); );
} }
@ -220,14 +222,16 @@ const YearSelector = ({ date, minDate, maxDate, onSelect }) => {
return ( return (
<div className={styles.pager}> <div className={styles.pager}>
<div className={styles.left}>
<Button <Button
icon={<Chevron />} icon={<Chevron />}
size="small" size="small"
className={styles.left}
onClick={handlePrevClick} onClick={handlePrevClick}
disabled={years[0] <= minYear} disabled={years[0] <= minYear}
variant="light" variant="light"
/> />
</div>
<div className={styles.middle}>
<table> <table>
<tbody> <tbody>
{chunk(years, 5).map((row, i) => ( {chunk(years, 5).map((row, i) => (
@ -248,14 +252,16 @@ const YearSelector = ({ date, minDate, maxDate, onSelect }) => {
))} ))}
</tbody> </tbody>
</table> </table>
</div>
<div className={styles.right}>
<Button <Button
icon={<Chevron />} icon={<Chevron />}
size="small" size="small"
className={styles.right}
onClick={handleNextClick} onClick={handleNextClick}
disabled={years[years.length - 1] > maxYear} disabled={years[years.length - 1] > maxYear}
variant="light" variant="light"
/> />
</div> </div>
</div>
); );
}; };

View File

@ -3,11 +3,11 @@
flex-direction: column; flex-direction: column;
font-size: var(--font-size-small); font-size: var(--font-size-small);
flex: 1; flex: 1;
min-height: 285px; min-height: 306px;
} }
.calendar table { .calendar table {
flex: 1; width: 100%;
border-spacing: 5px; border-spacing: 5px;
} }
@ -64,18 +64,34 @@
font-size: var(--font-size-normal); font-size: var(--font-size-normal);
} }
.body {
display: flex;
}
.selector { .selector {
cursor: pointer; cursor: pointer;
} }
.pager { .pager {
display: flex; display: flex;
flex: 1;
} }
.pager button { .pager button {
align-self: center; align-self: center;
} }
.middle {
flex: 1;
}
.left,
.right {
display: flex;
justify-content: center;
align-items: center;
}
.left svg { .left svg {
transform: rotate(90deg); transform: rotate(90deg);
} }