Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeScript Types #31

Open
spsaucier opened this issue Jul 6, 2022 · 0 comments
Open

TypeScript Types #31

spsaucier opened this issue Jul 6, 2022 · 0 comments

Comments

@spsaucier
Copy link

I came up with these types for use with TypeScript. Feel free to borrow.

index.d.ts

interface ITheme {
  primary?: string;
  secondary?: string;
  background?: string;
  buttons?: {
    disabled?: {
      color?: string;
      background?: string;
    };
    confirm?: {
      color?: string;
      background?: string;
      hover?: {
        color?: string;
        background?: string;
      };
    };
  }
  feedback?: {
    success?: {
      color?: string;
    };
    failed?: {
      color?: string;
    };
  }
};

declare module '@mooncake-dev/react-day-time-picker' {
  import type React from 'react';

  interface DayTimePickerProps {
    timeSlotSizeMinutes: number;
    isLoading: boolean;
    isDone: boolean;
    err: string;
    onConfirm: (time: Date) => any;
    confirmText?: string;
    loadingText?: string;
    doneText?: string;
    timeSlotValidator?: (time: Date) => boolean;
    theme?: ITheme;
  }
  export default class DayTimePicker extends React.Component<DayTimePickerProps> {}
}

In the end, I'm not going to use this package. It looks nice and does what I want in general, but it is virtually impossible to customize in any meaningful way without forking. I'll be using a normal calendar plugin (like react-day-picker) and then building a component to display available time slots.

@spsaucier spsaucier changed the title Types TypeScript Types Jul 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant