This repository has been archived by the owner on Oct 6, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Claire Hsu
authored
May 2, 2019
1 parent
b2758f5
commit 9e7b7d3
Showing
4 changed files
with
96 additions
and
8 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,65 @@ | ||
import React from 'react'; | ||
import Modal from './Modal'; | ||
import Button from '../Button'; | ||
import Input from '../Form/Input'; | ||
import Dropdown from '../Dropdown'; | ||
|
||
export default class ModalDropdownDemo extends React.Component { | ||
state = { | ||
isModalOpen: false, | ||
}; | ||
|
||
toggle = () => { | ||
this.setState({ isModalOpen: !this.state.isModalOpen }); | ||
}; | ||
|
||
onCancel = () => { | ||
this.toggle(); | ||
|
||
setTimeout(() => { | ||
alert('Oh no! It has been canceled.'); | ||
}, 500); | ||
}; | ||
|
||
render() { | ||
const { body, ...props } = this.props; | ||
|
||
return ( | ||
<div> | ||
<Dropdown placement="top" width={250} trigger={<Button variant="success">Open Dropdown</Button>}> | ||
<Dropdown.Header title="Dropdown" /> | ||
|
||
<Dropdown.Body> | ||
<Dropdown.SectionTitle>Section One</Dropdown.SectionTitle> | ||
<Dropdown.Item onClick={this.toggle} as="button"> | ||
Open Modal | ||
</Dropdown.Item> | ||
</Dropdown.Body> | ||
|
||
<Dropdown.Footer>Footer</Dropdown.Footer> | ||
</Dropdown> | ||
|
||
<Modal | ||
open={this.state.isModalOpen} | ||
onClose={this.toggle} | ||
title="Example Dropdown Modal" | ||
{...props}> | ||
<Modal.Body> | ||
<> | ||
{body} | ||
<Input autoFocus name="password" label="Password" /> | ||
</> | ||
</Modal.Body> | ||
|
||
<Modal.Footer> | ||
<Button.Group justifyContent="flex-end"> | ||
<Button variant="gray" onClick={this.onCancel}> | ||
Cancel | ||
</Button> | ||
</Button.Group> | ||
</Modal.Footer> | ||
</Modal> | ||
</div> | ||
); | ||
} | ||
} |
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
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