forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add unstyled KuiModal components. (elastic#13199)
- Loading branch information
Showing
40 changed files
with
850 additions
and
14 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<a class="kuiLink" href="#">More info</a> |
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,26 @@ | ||
import React from 'react'; | ||
|
||
import { | ||
GuideDemo, | ||
GuidePage, | ||
GuideSection, | ||
GuideSectionTypes, | ||
} from '../../components'; | ||
|
||
const linkHtml = require('./link.html'); | ||
|
||
export default props => ( | ||
<GuidePage title={props.route.name}> | ||
<GuideSection | ||
title="Link" | ||
source={[{ | ||
type: GuideSectionTypes.HTML, | ||
code: linkHtml, | ||
}]} | ||
> | ||
<GuideDemo | ||
html={linkHtml} | ||
/> | ||
</GuideSection> | ||
</GuidePage> | ||
); |
51 changes: 51 additions & 0 deletions
51
ui_framework/doc_site/src/views/modal/confirm_modal_example.js
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,51 @@ | ||
import React, { | ||
Component, | ||
} from 'react'; | ||
|
||
import { | ||
KuiConfirmModal, | ||
KuiModalOverlay, | ||
} from '../../../../components'; | ||
|
||
export class ConfirmModalExample extends Component { | ||
constructor(props) { | ||
super(props); | ||
this.state = { | ||
showConfirmModal: false | ||
}; | ||
this.closeModal = this.closeModal.bind(this); | ||
this.showModal = this.showModal.bind(this); | ||
} | ||
|
||
closeModal() { | ||
this.setState({ showConfirmModal: false }); | ||
} | ||
|
||
showModal() { | ||
this.setState({ showConfirmModal: true }); | ||
} | ||
|
||
render() { | ||
return ( | ||
<div> | ||
<button onClick={this.showModal}> | ||
Show Modal | ||
</button> | ||
{ | ||
this.state.showConfirmModal ? | ||
<KuiModalOverlay> | ||
<KuiConfirmModal | ||
message="This is a confirmation modal example" | ||
title="A confirmation modal" | ||
onCancel={this.closeModal} | ||
onConfirm={this.closeModal} | ||
cancelButtonText="Cancel" | ||
confirmButtonText="Confirm" | ||
/> | ||
</KuiModalOverlay> | ||
: null | ||
} | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import React from 'react'; | ||
|
||
import { renderToHtml } from '../../services'; | ||
|
||
import { | ||
GuideDemo, | ||
GuidePage, | ||
GuideSection, | ||
GuideSectionTypes, | ||
} from '../../components'; | ||
|
||
import { StaticConfirmModal } from './static'; | ||
const staticConfirmModalSource = require('!!raw!./static'); | ||
const staticConfirmModalHtml = renderToHtml(StaticConfirmModal); | ||
|
||
import { ConfirmModalExample } from './confirm_modal_example'; | ||
const showConfirmModalSource = require('!!raw!./confirm_modal_example'); | ||
const showConfirmModalHtml = renderToHtml(ConfirmModalExample); | ||
|
||
export default props => ( | ||
<GuidePage title={props.route.name}> | ||
|
||
<GuideSection | ||
title="Confirmation Modal" | ||
source={[{ | ||
type: GuideSectionTypes.JS, | ||
code: staticConfirmModalSource, | ||
}, { | ||
type: GuideSectionTypes.HTML, | ||
code: staticConfirmModalHtml, | ||
}]} | ||
> | ||
<GuideDemo> | ||
<StaticConfirmModal /> | ||
</GuideDemo> | ||
</GuideSection> | ||
|
||
<GuideSection | ||
title="Pop up Confirmation Modal with Overlay" | ||
source={[{ | ||
type: GuideSectionTypes.JS, | ||
code: showConfirmModalSource, | ||
}, { | ||
type: GuideSectionTypes.HTML, | ||
code: showConfirmModalHtml, | ||
}]} | ||
> | ||
<GuideDemo> | ||
<ConfirmModalExample /> | ||
</GuideDemo> | ||
</GuideSection> | ||
</GuidePage> | ||
); |
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,16 @@ | ||
import React from 'react'; | ||
|
||
import { | ||
KuiConfirmModal, | ||
} from '../../../../components'; | ||
|
||
export const StaticConfirmModal = () => ( | ||
<KuiConfirmModal | ||
onCancel={() => {}} | ||
onConfirm={() => {}} | ||
confirmButtonText="Confirm" | ||
cancelButtonText="Cancel" | ||
message="This is a confirmation modal" | ||
title="Confirm Modal Title" | ||
/> | ||
); |
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
|
||
// Components | ||
|
||
@import './avatar/index'; | ||
@import './header/index'; | ||
@import './icon/index'; | ||
@import './key_pad_menu/index'; | ||
@import './link/index'; | ||
@import './page/index'; | ||
@import './popover/index'; | ||
@import './typography/index'; | ||
@import 'avatar/index'; | ||
@import 'header/index'; | ||
@import 'icon/index'; | ||
@import 'key_pad_menu/index'; | ||
@import 'link/index'; | ||
@import 'modal/index'; | ||
@import 'page/index'; | ||
@import 'popover/index'; | ||
@import 'typography/index'; |
45 changes: 45 additions & 0 deletions
45
ui_framework/src/components/modal/__snapshots__/confirm_modal.test.js.snap
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,45 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`renders KuiConfirmModal 1`] = ` | ||
<div | ||
aria-label="aria-label" | ||
class="kuiModal testClass1 testClass2" | ||
data-tests-subj="test subject string" | ||
style="width:450px;" | ||
> | ||
<div | ||
class="kuiModalHeader" | ||
> | ||
<div | ||
class="kuiModalHeader__title" | ||
data-test-subj="confirmModalTitleText" | ||
> | ||
A confirmation modal | ||
</div> | ||
</div> | ||
<div | ||
class="kuiModalBody" | ||
> | ||
<div | ||
class="kuiModalBodyText" | ||
data-test-subj="confirmModalBodyText" | ||
> | ||
This is a confirmation modal example | ||
</div> | ||
</div> | ||
<div | ||
class="kuiModalFooter" | ||
> | ||
<button | ||
data-test-subj="confirmModalCancelButton" | ||
> | ||
Cancel Button Text | ||
</button> | ||
<button | ||
data-test-subj="confirmModalConfirmButton" | ||
> | ||
Confirm Button Text | ||
</button> | ||
</div> | ||
</div> | ||
`; |
11 changes: 11 additions & 0 deletions
11
ui_framework/src/components/modal/__snapshots__/modal.test.js.snap
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,11 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`renders KuiModal 1`] = ` | ||
<div | ||
aria-label="aria-label" | ||
class="kuiModal testClass1 testClass2" | ||
data-test-subj="test subject string" | ||
> | ||
children | ||
</div> | ||
`; |
11 changes: 11 additions & 0 deletions
11
ui_framework/src/components/modal/__snapshots__/modal_body.test.js.snap
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,11 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`renders KuiModalBody 1`] = ` | ||
<div | ||
aria-label="aria-label" | ||
class="kuiModalBody testClass1 testClass2" | ||
data-test-subj="test subject string" | ||
> | ||
children | ||
</div> | ||
`; |
11 changes: 11 additions & 0 deletions
11
ui_framework/src/components/modal/__snapshots__/modal_body_text.test.js.snap
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,11 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`renders KuiModalBodyText 1`] = ` | ||
<div | ||
aria-label="aria-label" | ||
class="kuiModalBodyText testClass1 testClass2" | ||
data-test-subj="test subject string" | ||
> | ||
children | ||
</div> | ||
`; |
11 changes: 11 additions & 0 deletions
11
ui_framework/src/components/modal/__snapshots__/modal_footer.test.js.snap
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,11 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`renders KuiModalFooter 1`] = ` | ||
<div | ||
aria-label="aria-label" | ||
class="kuiModalFooter testClass1 testClass2" | ||
data-test-subj="test subject string" | ||
> | ||
children | ||
</div> | ||
`; |
Oops, something went wrong.