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

View File

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

View File

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

View File

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