mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-07 00:07:07 +00:00
Merge pull request #34658 from vikram-gsu/master
Added types for react-leaflet-sidebarv2
This commit is contained in:
+42
@@ -0,0 +1,42 @@
|
||||
// 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.ElementType;
|
||||
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?: () => void;
|
||||
children: TabType;
|
||||
}
|
||||
|
||||
declare class Sidebar extends React.Component<SidebarProps, any> {}
|
||||
|
||||
export { Tab, Sidebar };
|
||||
@@ -0,0 +1,25 @@
|
||||
import * as React from 'react';
|
||||
import { Sidebar, Tab } from 'react-leaflet-sidebarv2';
|
||||
|
||||
const MySidebar = (
|
||||
<Sidebar
|
||||
id='sidebar'
|
||||
collapsed={false}
|
||||
selected={'home'}
|
||||
closeIcon='fa'
|
||||
position='right'>
|
||||
<Tab
|
||||
id='home'
|
||||
header='Home'
|
||||
icon='fa fa-home'>
|
||||
No place like home!
|
||||
</Tab>
|
||||
<Tab
|
||||
id='settings'
|
||||
header='Settings'
|
||||
icon='fa fa-cog'
|
||||
anchor='bottom'>
|
||||
In Settings.
|
||||
</Tab>
|
||||
</Sidebar>
|
||||
);
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"jsx": "react",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"react-leaflet-sidebarv2-tests.tsx"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user