Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
paragon
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
paragon
Commits
f39744d7
Commit
f39744d7
authored
Nov 17, 2017
by
Michael Roytman
Committed by
Farhanah Sheets
Dec 20, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(modal): Add backdrop style to open Modals
parent
e55f1939
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
36 additions
and
9 deletions
+36
-9
.storybook/__snapshots__/Storyshots.test.js.snap
+7
-7
src/Modal/Modal.scss
+9
-0
src/Modal/Modal.test.jsx
+4
-1
src/Modal/index.jsx
+16
-1
No files found.
.storybook/__snapshots__/Storyshots.test.js.snap
View file @
f39744d7
...
...
@@ -695,7 +695,7 @@ exports[`Storyshots Modal basic usage 1`] = `
<div
aria-labelledby="id2"
aria-modal={true}
className="modal
show modal-open
"
className="modal
modal-open modal-backdrop show
"
role="dialog"
>
<div
...
...
@@ -757,7 +757,7 @@ exports[`Storyshots Modal configurable buttons 1`] = `
<div
aria-labelledby="id3"
aria-modal={true}
className="modal
show modal-open
"
className="modal
modal-open modal-backdrop show
"
role="dialog"
>
<div
...
...
@@ -846,7 +846,7 @@ exports[`Storyshots Modal configurable buttons that perform actions 1`] = `
<div
aria-labelledby="id5"
aria-modal={true}
className="modal
show modal-open
"
className="modal
modal-open modal-backdrop show
"
role="dialog"
>
<div
...
...
@@ -917,7 +917,7 @@ exports[`Storyshots Modal configurable close button 1`] = `
<div
aria-labelledby="id6"
aria-modal={true}
className="modal
show modal-open
"
className="modal
modal-open modal-backdrop show
"
role="dialog"
>
<div
...
...
@@ -979,7 +979,7 @@ exports[`Storyshots Modal configurable title and body 1`] = `
<div
aria-labelledby="id4"
aria-modal={true}
className="modal
show modal-open
"
className="modal
modal-open modal-backdrop show
"
role="dialog"
>
<div
...
...
@@ -1051,7 +1051,7 @@ exports[`Storyshots Modal modal invoked via a button 1`] = `
<div
aria-labelledby="id7"
aria-modal={true}
className="modal
show
"
className="modal
fade
"
role="dialog"
>
<div
...
...
@@ -1123,7 +1123,7 @@ exports[`Storyshots Modal modal with element body 1`] = `
<div
aria-labelledby="id8"
aria-modal={true}
className="modal
show modal-open
"
className="modal
modal-open modal-backdrop show
"
role="dialog"
>
<div
...
...
src/Modal/Modal.scss
View file @
f39744d7
@import
"~bootstrap/scss/_variables"
;
@import
"~bootstrap/scss/_modal"
;
.modal-open
{
display
:
block
;
}
.modal-backdrop
{
background-color
:
rgba
(
0
,
0
,
0
,
0
.3
);
// Fade for backdrop
&
.fade
{
opacity
:
0
;
}
&
.show
{
opacity
:
1
;
}
}
src/Modal/Modal.test.jsx
View file @
f39744d7
...
...
@@ -7,7 +7,10 @@ import Button from '../Button';
const
modalOpen
=
(
isOpen
,
wrapper
)
=>
{
expect
(
wrapper
.
childAt
(
0
).
hasClass
(
'modal-open'
)).
toEqual
(
isOpen
);
expect
(
wrapper
.
find
(
'.modal'
).
hasClass
(
'modal-open'
)).
toEqual
(
isOpen
);
expect
(
wrapper
.
find
(
'.modal'
).
hasClass
(
'modal-backdrop'
)).
toEqual
(
isOpen
);
expect
(
wrapper
.
find
(
'.modal'
).
hasClass
(
'show'
)).
toEqual
(
isOpen
);
expect
(
wrapper
.
find
(
'.modal'
).
hasClass
(
'fade'
)).
toEqual
(
!
isOpen
);
expect
(
wrapper
.
state
(
'open'
)).
toEqual
(
isOpen
);
};
const
title
=
'Modal title'
;
...
...
src/Modal/index.jsx
View file @
f39744d7
...
...
@@ -99,8 +99,23 @@ class Modal extends React.Component {
}
render
()
{
const
{
open
}
=
this
.
state
;
return
(
<
div
className=
{
classNames
(
styles
.
modal
,
styles
.
show
,
{
[
styles
[
'modal-open'
]]:
this
.
state
.
open
})
}
role=
"dialog"
aria
-
modal
aria
-
labelledby=
{
this
.
headerId
}
>
<
div
className=
{
classNames
(
styles
.
modal
,
{
[
styles
[
'modal-open'
]]:
open
,
[
styles
[
'modal-backdrop'
]]:
open
,
[
styles
.
show
]:
open
,
[
styles
.
fade
]:
!
open
,
},
)
}
role=
"dialog"
aria
-
modal
aria
-
labelledby=
{
this
.
headerId
}
>
<
div
className=
{
styles
[
'modal-dialog'
]
}
>
<
div
className=
{
styles
[
'modal-content'
]
}
>
<
div
className=
{
styles
[
'modal-header'
]
}
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment