Skip to content

Commit 5d1231b

Browse files
enum to string fix, issue with keys in Config not fixed
1 parent 75a70b6 commit 5d1231b

File tree

3 files changed

+4
-7
lines changed

3 files changed

+4
-7
lines changed

src/components/Input.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import React, { useCallback, useContext, useEffect, useRef } from "react";
44
import { BORDER_COLOR, DATE_FORMAT, RING_COLOR } from "../constants";
55
import DatepickerContext from "../contexts/DatepickerContext";
66
import { dateIsValid } from "../helpers";
7-
import { PopoverDirectionType } from "../types";
87

98
import ToggleButton from "./ToggleButton";
109

@@ -200,8 +199,8 @@ const Input: React.FC<Props> = (e: Props) => {
200199
div.classList.add("block");
201200

202201
// window.innerWidth === 767
203-
const popoverOnUp = popoverDirection == PopoverDirectionType.up;
204-
const popoverOnDown = popoverDirection === PopoverDirectionType.down;
202+
const popoverOnUp = popoverDirection == "up";
203+
const popoverOnDown = popoverDirection === "down";
205204
if (
206205
popoverOnUp ||
207206
(window.innerWidth > 767 &&

src/components/Shortcuts.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ const Shortcuts: React.FC = () => {
9797
if (Object.keys(DEFAULT_SHORTCUTS).includes(item)) {
9898
return [item, DEFAULT_SHORTCUTS[item]];
9999
} else {
100+
// using | makes this fail in typecheck as [string] is no longer recognised?
100101
if (configs.shortcuts && configs?.shortcuts[item]) {
101102
const customConfig = configs?.shortcuts[item];
102103
const text = customConfig?.text;

src/types/index.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,7 @@ export type ClassNamesTypeProp = {
4444
footer?: (p?: object | null | undefined) => string | undefined;
4545
};
4646

47-
export enum PopoverDirectionType {
48-
up = "up",
49-
down = "down"
50-
}
47+
export type PopoverDirectionType = "up" | "down";
5148

5249
export interface DatepickerType {
5350
primaryColor?: string;

0 commit comments

Comments
 (0)