From fa2fc8c39c46c5aa16cd915f5ccc593899337fbf Mon Sep 17 00:00:00 2001 From: devalon Date: Wed, 21 Aug 2019 04:15:16 +0900 Subject: [PATCH] Feature/support dropdownmenu position fixed (#37669) * fix(reactstrap): Add positionFixed property to DropdownMenu of reactstrap * style(reactstrap): Format some test code * fix(reactstrap): Fix the component unit tests * style(reactstrap): Format code style --- types/reactstrap/index.d.ts | 1 + types/reactstrap/lib/DropdownMenu.d.ts | 1 + types/reactstrap/reactstrap-tests.tsx | 32 +++++++++++++++++++++++ types/reactstrap/v7/lib/DropdownMenu.d.ts | 1 + types/reactstrap/v7/reactstrap-tests.tsx | 32 +++++++++++++++++++++++ 5 files changed, 67 insertions(+) diff --git a/types/reactstrap/index.d.ts b/types/reactstrap/index.d.ts index 479db55494..75343e4b64 100644 --- a/types/reactstrap/index.d.ts +++ b/types/reactstrap/index.d.ts @@ -9,6 +9,7 @@ // Prabodh Tiwari // Georg Steinmetz // Kyle Tsang +// Hayato Shimokawa // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.9 diff --git a/types/reactstrap/lib/DropdownMenu.d.ts b/types/reactstrap/lib/DropdownMenu.d.ts index b7799abedc..163232f5ab 100644 --- a/types/reactstrap/lib/DropdownMenu.d.ts +++ b/types/reactstrap/lib/DropdownMenu.d.ts @@ -11,6 +11,7 @@ export interface DropdownMenuProps extends React.HTMLAttributes { flip?: boolean; modifiers?: Popper.Modifiers; persist?: boolean; + positionFixed?: boolean; } declare class DropdownMenu extends React.Component {} diff --git a/types/reactstrap/reactstrap-tests.tsx b/types/reactstrap/reactstrap-tests.tsx index c4bd5340b9..c58fe6e409 100644 --- a/types/reactstrap/reactstrap-tests.tsx +++ b/types/reactstrap/reactstrap-tests.tsx @@ -4563,3 +4563,35 @@ function Example128() { ); } + +class Example129 extends React.Component { + constructor(props: any) { + super(props); + + this.toggle = this.toggle.bind(this); + this.state = { + dropdownOpen: false, + }; + } + + toggle() { + this.setState({ + dropdownOpen: !this.state.dropdownOpen, + }); + } + + render() { + return ( + + Dropdown + + Header + Action + Another Action + + Another Action + + + ); + } +} diff --git a/types/reactstrap/v7/lib/DropdownMenu.d.ts b/types/reactstrap/v7/lib/DropdownMenu.d.ts index fedb12f4c3..813996b08e 100644 --- a/types/reactstrap/v7/lib/DropdownMenu.d.ts +++ b/types/reactstrap/v7/lib/DropdownMenu.d.ts @@ -10,6 +10,7 @@ export type DropdownMenuProps = React.HTMLAttributes & { flip?: boolean; modifiers?: Popper.Modifiers; persist?: boolean; + positionFixed?: boolean; } & T; declare class DropdownMenu extends React.Component> {} diff --git a/types/reactstrap/v7/reactstrap-tests.tsx b/types/reactstrap/v7/reactstrap-tests.tsx index 67c24bce28..59b226c8b1 100644 --- a/types/reactstrap/v7/reactstrap-tests.tsx +++ b/types/reactstrap/v7/reactstrap-tests.tsx @@ -4357,3 +4357,35 @@ function Example126() { ); } + +class Example127 extends React.Component { + constructor(props: any) { + super(props); + + this.toggle = this.toggle.bind(this); + this.state = { + dropdownOpen: false, + }; + } + + toggle() { + this.setState({ + dropdownOpen: !this.state.dropdownOpen, + }); + } + + render() { + return ( + + Dropdown + + Header + Action + Another Action + + Another Action + + + ); + } +}