@afconsult/apollo
Advanced tools
Comparing version 1.2.10 to 1.3.0
{ | ||
"name": "@afconsult/apollo", | ||
"version": "1.2.10", | ||
"version": "1.3.0", | ||
"description": "Design system for ÅF Web Apps", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
## Modal | ||
The Modal component pass the `onToggle` prop via context to the [ModalHeader](../ModalHeader) component. | ||
#### Example | ||
``` javascript | ||
``` jsx | ||
import React from 'react'; | ||
@@ -14,3 +13,3 @@ import { Modal, ModalBody, ModalHeader, ModalFooter } from '@afconsult/apollo'; | ||
super(props); | ||
this.state = { isOpen: false }; | ||
this.state = { open: false }; | ||
this.handleToggle = this.handleToggle.bind(this); | ||
@@ -20,10 +19,10 @@ } | ||
handleToggle(e) { | ||
this.setState(state => { isOpen: !state.isOpen }); | ||
this.setState(prevState => { open: !prevState.open }); | ||
} | ||
render() { | ||
const { isOpen } = this.state; | ||
const { open } = this.state; | ||
return ( | ||
<Modal onToggle={this.handleToggle} open={isOpen}> | ||
<Modal onToggle={this.handleToggle} open={open}> | ||
<ModalHeader> | ||
@@ -46,9 +45,9 @@ Header | ||
|-------------------|----------|-------------|-------------| | ||
| autoFocus | `bool` | `true` | | ||
| backdropClassName | `string` | `undefined` | | ||
| children | `node` | `undefined` | | ||
| autoFocus | `bool` | `true` | Specifies that the modal should automatically get focus when opened. | | ||
| backdropClassName | `string` | `undefined` | | | ||
| children | `node` | `undefined` | Collection of DOM child elements. | | ||
| className | `string` | `undefined` | Classes to be applied to the DOM element. | | ||
| contentClassName | `string` | `undefined` | | ||
| dialogClassName | `string` | `undefined` | | ||
| keyboard | `bool` | `false` | | ||
| contentClassName | `string` | `undefined` | | | ||
| dialogClassName | `string` | `undefined` | | | ||
| keyboard | `bool` | `false` | Allow closing the modal with the escape button if set `true`. | | ||
| onClosed | `func` | `undefined` | Called when done transitioning out. | | ||
@@ -64,3 +63,3 @@ | onEnter | `func` | `undefined` | Called on componentDidMount. | | ||
|-----------|------------------|-------------|-------------| | ||
| children | `node` | `undefined` | | ||
| children | `node` | `undefined` | Collection of DOM child elements. | | ||
| className | `string` | `undefined` | Classes to be applied to the DOM element. | | ||
@@ -67,0 +66,0 @@ | tag | `[func, string]` | `h3` | Specifies the DOM element to be used. | |
@@ -7,13 +7,18 @@ ### Tag | ||
super(props); | ||
this.handleClose = this.handleClose.bind(this); | ||
this.state = { open: true }; | ||
this.handleToggle = this.handleToggle.bind(this); | ||
} | ||
handleClose(e) { | ||
handleToggle(e) { | ||
this.setState(prevState => ({ open: !prevState.open })); | ||
} | ||
render() { | ||
const { open } = this.state; | ||
return ( | ||
<Tag | ||
icon="https://picsum.photos/200/200/?image=1" | ||
onClose={this.handleClose} | ||
onToggle={this.handleToggle} | ||
open={open} | ||
>Stockholm | ||
@@ -20,0 +25,0 @@ </Follow> |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
3815623
15632