Fix compatibility with typescript 2.4+ (#1615)

* Added a generic props interface to share with other components

* use the new DrawerCommonProps interface

* use the new DrawerCommonProps interface

* Fix compatibility with Typescript 2.3+
old
Lucas Nascimento 2017-09-20 19:16:38 -03:00 committed by Javi Velasco
parent e1f320c580
commit b381db4054
4 changed files with 13 additions and 13 deletions

View File

@ -28,7 +28,7 @@ export interface DrawerTheme {
wrapper?: string;
}
export interface DrawerProps extends ReactToolbox.Props {
export interface DrawerCommonProps {
/**
* If true, the drawer will be visible.
* @default false
@ -47,10 +47,6 @@ export interface DrawerProps extends ReactToolbox.Props {
* Callback function to be invoked when the overlay is clicked.
*/
onOverlayClick?: Function;
/**
* Classnames object defining the component style.
*/
theme?: DrawerTheme;
/**
* Type of drawer. It can be left or right to display the drawer on the left or right side of the screen.
* @default left
@ -63,6 +59,13 @@ export interface DrawerProps extends ReactToolbox.Props {
withOverlay?: boolean;
}
export interface DrawerProps extends ReactToolbox.Props, DrawerCommonProps {
/**
* Classnames object defining the component style.
*/
theme?: DrawerTheme;
}
export class Drawer extends React.Component<DrawerProps, {}> { }
export default Drawer;

View File

@ -1,8 +1,5 @@
import * as React from "react";
import ReactToolbox from "../index";
import { NavDrawer } from './NavDrawer';
import { Panel } from './Panel';
import { Sidebar } from './Sidebar';
export interface LayoutTheme {
appbarFixed?: string;
@ -54,7 +51,7 @@ export interface LayoutProps extends ReactToolbox.Props {
/**
* Children to pass through the component.
*/
children?: [NavDrawer | Panel | Sidebar];
children?: JSX.Element | JSX.Element[];
/**
* Classnames object defining the component style.
*/

View File

@ -1,5 +1,5 @@
import * as React from "react";
import { DrawerProps } from '../drawer/Drawer';
import { DrawerCommonProps } from '../drawer/Drawer';
export interface NavDrawerTheme {
/**
@ -12,7 +12,7 @@ export interface NavDrawerTheme {
clipped?: string;
}
export interface NavDrawerProps extends DrawerProps {
export interface NavDrawerProps extends DrawerCommonProps {
/**
* If true, the drawer will be shown as an overlay.
* @default false

View File

@ -1,5 +1,5 @@
import * as React from "react";
import { DrawerProps } from '../drawer/Drawer';
import { DrawerCommonProps } from '../drawer/Drawer';
export interface SidebarTheme {
/**
@ -12,7 +12,7 @@ export interface SidebarTheme {
pinned?: string;
}
export interface SidebarProps extends DrawerProps {
export interface SidebarProps extends DrawerCommonProps {
/**
* If true, when the `AppBar` gets pinned, it will stand over the `Drawer`.
* @default false