Skip to content

TypeScript Types #31

@spsaucier

Description

@spsaucier

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions