Skip to content

Commit

Permalink
Merge pull request #912 from CPatchane/xsmall_modal
Browse files Browse the repository at this point in the history
Add xsmall modal size
  • Loading branch information
CPatchane authored Apr 23, 2019
2 parents 335fc29 + 7859e55 commit bc1f730
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
7 changes: 4 additions & 3 deletions react/Modal/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,13 @@ initialState = { modalOpened: false};

### Size

Several sizes avalaible: `small`, `medium`, `large`, `xlarge`, `xxlarge`.
Several sizes avalaible: `xsmall, small`, `medium`, `large`, `xlarge`, `xxlarge`.
`small` being the default one.

```
initialState = { modalOpened: false};
const sizes = [
'xsmall',
'small',
'medium',
'large',
Expand Down Expand Up @@ -268,11 +269,11 @@ class ModalCounterWithAnimatedHeader extends React.Component {
increment () {
this.setState({ counter: this.state.counter + 1 })
}
componentWillUnmount() {
clearTimeout(this.timeout)
}
render () {
return (
<Modal
Expand Down
9 changes: 8 additions & 1 deletion react/Modal/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,14 @@ Modal.propTypes = {
/** If has a value, the modal will be rendered inside a portal and its value will be passed to Portal
to control the rendering destination of the Modal */
into: PropTypes.string,
size: PropTypes.oneOf(['small', 'medium', 'large', 'xlarge', 'xxlarge']),
size: PropTypes.oneOf([
'xsmall',
'small',
'medium',
'large',
'xlarge',
'xxlarge'
]),
height: PropTypes.string,
width: PropTypes.string,
spacing: PropTypes.oneOf(['small', 'large']),
Expand Down
3 changes: 3 additions & 0 deletions react/Modal/styles.styl
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
&.c-modal--fullscreen
@extend $modal--fullscreen

.c-modal--xsmall
@extend $modal--xsmall

.c-modal--small
@extend $modal--small

Expand Down
4 changes: 3 additions & 1 deletion stylus/components/modals.styl
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@
\*------------------------------------*/

// Modal sizes
xsmall-width = rem(384)
small-width = rem(544)
medium-width = rem(576)
large-width = rem(640)
xlarge-width = rem(800)
xxlarge-width = rem(960)

// Modal margins
xsmall-margin = rem(8)
small-margin = rem(8)
medium-margin = rem(24)
large-margin = rem(48)
Expand Down Expand Up @@ -66,7 +68,7 @@ $modal
background-color white
color var(--charcoalGrey)

for size in 'small' 'medium' 'large' 'xlarge' 'xxlarge'
for size in 'xsmall' 'small' 'medium' 'large' 'xlarge' 'xxlarge'
$modal--{size}
width lookup(size + '-width')

Expand Down

0 comments on commit bc1f730

Please sign in to comment.