Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(accordion): fix callbacks to use inputs
- Loading branch information
1 parent
f475111
commit e96e83a
Showing
3 changed files
with
64 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
Copyright (c) Uber Technologies, Inc. | ||
This source code is licensed under the MIT license found in the | ||
LICENSE file in the root directory of this source tree. | ||
*/ | ||
// @flow | ||
|
||
import * as React from 'react'; | ||
|
||
import {StatelessAccordion, Panel} from '../index.js'; | ||
|
||
export default function Scenario() { | ||
const [expanded, setExpanded] = React.useState(['P1', 'P2']); | ||
return ( | ||
<StatelessAccordion | ||
expanded={expanded} | ||
accordion={false} | ||
onChange={({key, expanded}) => { | ||
console.log(key, '----'); | ||
console.log(expanded); | ||
setExpanded(expanded); | ||
}} | ||
> | ||
<Panel key="P1" title="Panel 1"> | ||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. | ||
</Panel> | ||
<Panel key="P2" title="Panel 2"> | ||
Quisque luctus eu sem et pharetra. | ||
</Panel> | ||
<Panel key="P3" title="Panel 3"> | ||
Proin egestas dui sed semper iaculis. | ||
</Panel> | ||
</StatelessAccordion> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters