Skip to content

Commit

Permalink
Review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
amrocha committed Sep 20, 2019
1 parent 7cd3bce commit d98c032
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 15 deletions.
9 changes: 3 additions & 6 deletions src/components/DatePicker/DatePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,9 @@ export function DatePicker({
const [hoverDate, setHoverDate] = useState<Date | undefined>(undefined);
const [focusDate, setFocusDate] = useState<Date | undefined>(undefined);

useEffect(
() => {
setFocusDate(undefined);
},
[selected],
);
useEffect(() => {
setFocusDate(undefined);
}, [selected]);

const handleFocus = useCallback((date: Date) => {
setFocusDate(date);
Expand Down
15 changes: 6 additions & 9 deletions src/components/DatePicker/components/Day/Day.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export interface DayProps {
disabled?: boolean;
onClick?(day: Date): void;
onHover?(day?: Date): void;
onFocus?(day?: Date): void;
onFocus?(day: Date): void;
}

export function Day({
Expand All @@ -31,14 +31,11 @@ export function Day({
const i18n = useI18n();
const dayNode = useRef<HTMLButtonElement>(null);

useEffect(
() => {
if (focused && dayNode.current) {
dayNode.current.focus();
}
},
[focused],
);
useEffect(() => {
if (focused && dayNode.current) {
dayNode.current.focus();
}
}, [focused]);

if (!day) {
return <div className={styles.EmptyDay} onMouseOver={() => onHover(day)} />;
Expand Down

0 comments on commit d98c032

Please sign in to comment.