Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
logging-scratch-gui
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
David Goessmann
logging-scratch-gui
Commits
21a9afb5
Commit
21a9afb5
authored
6 years ago
by
Evelyn Eastmond
Browse files
Options
Downloads
Patches
Plain Diff
Adding Alert container to hold index and click handler.
parent
63c31576
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/components/alerts/alert.jsx
+25
-36
25 additions, 36 deletions
src/components/alerts/alert.jsx
src/containers/alert.jsx
+35
-0
35 additions, 0 deletions
src/containers/alert.jsx
src/containers/alerts.jsx
+2
-2
2 additions, 2 deletions
src/containers/alerts.jsx
with
62 additions
and
38 deletions
src/components/alerts/alert.jsx
+
25
−
36
View file @
21a9afb5
import
React
from
'
react
'
;
import
PropTypes
from
'
prop-types
'
;
import
bindAll
from
'
lodash.bindall
'
;
import
Box
from
'
../box/box.jsx
'
;
import
Button
from
'
../button/button.jsx
'
;
import
styles
from
'
./alert.css
'
;
class
AlertComponent
extends
React
.
Component
{
constructor
(
props
)
{
super
(
props
);
bindAll
(
this
,
[
'
handleOnCloseAlert
'
]);
}
handleOnCloseAlert
()
{
this
.
props
.
onCloseAlert
(
this
.
props
.
index
);
}
render
()
{
return
(
<
Box
className
=
{
styles
.
alert
}
>
<
div
className
=
{
styles
.
alertMessage
}
>
{
this
.
props
.
iconURL
?
(
<
img
className
=
{
styles
.
alertIcon
}
src
=
{
this
.
props
.
iconURL
}
/>
)
:
null
}
{
this
.
props
.
message
}
</
div
>
<
Button
className
=
{
styles
.
alertRemoveButton
}
onClick
=
{
this
.
handleOnCloseAlert
}
>
{
'
x
'
}
</
Button
>
</
Box
>
);
}
}
const
AlertComponent
=
({
iconURL
,
message
,
onCloseAlert
})
=>
(
<
Box
className
=
{
styles
.
alert
}
>
<
div
className
=
{
styles
.
alertMessage
}
>
{
iconURL
?
(
<
img
className
=
{
styles
.
alertIcon
}
src
=
{
iconURL
}
/>
)
:
null
}
{
message
}
</
div
>
<
Button
className
=
{
styles
.
alertRemoveButton
}
onClick
=
{
onCloseAlert
}
>
{
'
x
'
}
</
Button
>
</
Box
>
);
AlertComponent
.
propTypes
=
{
iconURL
:
PropTypes
.
string
,
index
:
PropTypes
.
number
,
message
:
PropTypes
.
string
,
onCloseAlert
:
PropTypes
.
func
.
isRequired
};
...
...
This diff is collapsed.
Click to expand it.
src/containers/alert.jsx
0 → 100644
+
35
−
0
View file @
21a9afb5
import
React
from
'
react
'
;
import
bindAll
from
'
lodash.bindall
'
;
import
PropTypes
from
'
prop-types
'
;
import
AlertComponent
from
'
../components/alerts/alert.jsx
'
;
class
Alert
extends
React
.
Component
{
constructor
(
props
)
{
super
(
props
);
bindAll
(
this
,
[
'
handleOnCloseAlert
'
]);
}
handleOnCloseAlert
()
{
this
.
props
.
onCloseAlert
(
this
.
props
.
index
);
}
render
()
{
return
(
<
AlertComponent
iconURL
=
{
this
.
props
.
iconURL
}
message
=
{
this
.
props
.
message
}
onCloseAlert
=
{
this
.
handleOnCloseAlert
}
/>
);
}
}
Alert
.
propTypes
=
{
iconURL
:
PropTypes
.
string
,
index
:
PropTypes
.
number
,
message
:
PropTypes
.
string
,
onCloseAlert
:
PropTypes
.
func
.
isRequired
};
export
default
Alert
;
This diff is collapsed.
Click to expand it.
src/containers/alerts.jsx
+
2
−
2
View file @
21a9afb5
...
...
@@ -8,7 +8,7 @@ import {
}
from
'
../reducers/alerts
'
;
import
Box
from
'
../components/box/box.jsx
'
;
import
Alert
Component
from
'
../co
mponents/al
er
t
s/alert.jsx
'
;
import
Alert
from
'
../co
ntain
ers/alert.jsx
'
;
const
Alerts
=
({
alertsList
,
...
...
@@ -20,7 +20,7 @@ const Alerts = ({
className
=
{
classNames
(
className
)
}
>
{
alertsList
.
map
((
a
,
index
)
=>
(
<
Alert
Component
<
Alert
iconURL
=
{
a
.
iconURL
}
index
=
{
index
}
key
=
{
index
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment