DefinitelyTyped/types/react-leaflet-sidebarv2/index.d.ts
Mhammadreza Deljavan 72fa663add icon and onOpen types does not correct (#41439)
* icon and onOpen types does not correct

Icon props in react-leaflet-sidebarv2 check for string or object so icon type must be ReactElement.
onOpen handler must take an id to set selected state.

* Update index.d.ts
2020-01-16 15:09:43 -05:00

43 lines
1.0 KiB
TypeScript

// Type definitions for react-leaflet-sidebarv2 0.6
// Project: https://github.com/condense/react-leaflet-sidebarv2
// Definitions by: Vikram Pareddy <https://github.com/vikram-gsu>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
import * as React from 'react';
type Icon = string | React.ReactElement;
type Anchor = 'top' | 'bottom';
type Position = 'left' | 'right';
interface TabProps {
id: string;
header: string;
icon: Icon;
anchor?: Anchor;
disabled?: boolean;
onClose?: () => void;
closeIcon?: Icon;
position?: Position;
active?: boolean;
}
declare class Tab extends React.Component<TabProps, any> {}
type TabType = React.ReactElement<Tab> | Array<React.ReactElement<Tab>>;
interface SidebarProps {
id: string;
collapsed: boolean;
position: Position;
selected: string;
closeIcon?: Icon;
onClose?: () => void;
onOpen?: (id: string) => void;
children: TabType;
}
declare class Sidebar extends React.Component<SidebarProps, any> {}
export { Tab, Sidebar };