Update types for react-sidebar 3.0.0

Added test case to check new properties are optional.
This commit is contained in:
Robin Luiten 2018-08-07 20:47:16 +10:00
parent 480f7557d2
commit f327f7cc69
2 changed files with 23 additions and 1 deletions

View File

@ -1,4 +1,4 @@
// Type definitions for react-sidebar 2.3
// Type definitions for react-sidebar 3.0
// Project: https://github.com/balloob/react-sidebar#readme
// Definitions by: Jeroen Vervaeke <https://github.com/jeroenvervaeke>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@ -23,6 +23,10 @@ export interface SidebarProps {
transitions?: boolean;
touch?: boolean;
touchHandleWidth?: number;
rootId?: string;
sidebarId?: string;
contentId?: string;
overlayId?: string;
}
export interface SidebarStyles {

View File

@ -8,6 +8,24 @@ const sidebarStyle: SidebarStyles = {
};
const sidebar1 = (
<Sidebar
defaultSidebarWidth={30}
docked={true}
open={true}
sidebar={sidebar}
styles={sidebarStyle}
onSetOpen={(open: boolean) => { }}
rootId="test-root-id"
sidebarId="test-sidebar-id"
contentId="test-content-id"
overlayId="test-overlay-id"
>
<h1>Content</h1>
</Sidebar>
);
// Test id properties are optional
const sidebar2 = (
<Sidebar
defaultSidebarWidth={30}
docked={true}