Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
E
exam_9
Project
Project
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
zarina
exam_9
Commits
198840b7
Commit
198840b7
authored
May 23, 2020
by
zarina
🌊
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#2
, получен и распечатан список контактов, добавлена модалка отображающая полную информацию
parent
a5378316
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
145 additions
and
0 deletions
+145
-0
Contact.css
src/components/Contact/Contact.css
+0
-0
Contact.js
src/components/Contact/Contact.js
+11
-0
FullContact.js
src/components/FullContact/FullContact.js
+0
-0
Backdrop.css
src/components/UI/Backdrop/Backdrop.css
+9
-0
Backdrop.js
src/components/UI/Backdrop/Backdrop.js
+11
-0
Modal.css
src/components/UI/Modal/Modal.css
+20
-0
Modal.js
src/components/UI/Modal/Modal.js
+25
-0
Contacts.js
src/containers/Contacts/Contacts.js
+69
-0
No files found.
src/components/Contact/Contact.css
0 → 100644
View file @
198840b7
src/components/Contact/Contact.js
0 → 100644
View file @
198840b7
import
React
from
"react"
;
const
Contact
=
props
=>
{
return
(
<
div
onClick
=
{
props
.
select
}
className
=
'Contact'
>
<
div
>
{
props
.
name
}
<
/div
>
<
/div
>
);
};
export
default
Contact
;
src/components/FullContact/FullContact.js
0 → 100644
View file @
198840b7
src/components/UI/Backdrop/Backdrop.css
0 → 100644
View file @
198840b7
.Backdrop
{
width
:
100%
;
height
:
100%
;
position
:
fixed
;
z-index
:
100
;
left
:
0
;
top
:
0
;
background-color
:
rgba
(
0
,
0
,
0
,
0.5
);
}
src/components/UI/Backdrop/Backdrop.js
0 → 100644
View file @
198840b7
import
React
from
"react"
;
import
"./Backdrop.css"
;
const
Backdrop
=
props
=>
{
return
props
.
show
?
<
div
className
=
"Backdrop"
onClick
=
{
props
.
clicked
}
/> : null
;
};
export
default
Backdrop
;
src/components/UI/Modal/Modal.css
0 → 100644
View file @
198840b7
.Modal
{
position
:
fixed
;
z-index
:
500
;
background-color
:
white
;
width
:
70%
;
border
:
1px
solid
#ccc
;
box-shadow
:
1px
1px
1px
black
;
padding
:
16px
;
left
:
15%
;
top
:
30%
;
box-sizing
:
border-box
;
transition
:
all
0.3s
ease-out
;
}
@media
(
min-width
:
600px
)
{
.Modal
{
width
:
500px
;
left
:
calc
(
50%
-
250px
);
}
}
src/components/UI/Modal/Modal.js
0 → 100644
View file @
198840b7
import
React
from
"react"
;
import
"./Modal.css"
;
import
Backdrop
from
"../Backdrop/Backdrop"
;
const
Modal
=
props
=>
{
return
(
<>
<
Backdrop
show
=
{
props
.
show
}
clicked
=
{
props
.
closed
}
/
>
<
div
className
=
"Modal"
style
=
{{
transform
:
props
.
show
?
"translateY(0)"
:
"translateY(-100vh)"
,
opacity
:
props
.
show
?
1
:
0
}}
>
{
props
.
children
}
<
/div
>
<
/
>
);
};
export
default
Modal
;
src/containers/Contacts/Contacts.js
0 → 100644
View file @
198840b7
import
React
,
{
Component
}
from
"react"
;
import
{
connect
}
from
"react-redux"
;
import
{
getContacts
}
from
"../../store/actions"
;
import
Contact
from
"../../components/Contact/Contact"
;
import
Modal
from
"../../components/Modal/Modal"
;
import
{
NavLink
}
from
"react-router-dom"
;
class
Contacts
extends
Component
{
state
=
{
selectContact
:
null
,
modalShow
:
false
}
componentDidMount
()
{
this
.
props
.
getContacts
()
}
selectHandler
=
(
id
)
=>
{
this
.
setState
({
selectContact
:
id
})
}
printContacts
=
()
=>
{
let
contacts
=
this
.
props
.
contacts
return
Object
.
keys
(
contacts
).
map
(
contact
=>
{
return
<
Contact
select
=
{()
=>
this
.
selectHandler
(
contact
)}
name
=
{
contacts
[
contact
].
name
}
email
=
{
contacts
[
contact
].
email
}
phone
=
{
contacts
[
contact
].
phone
}
photo
=
{
contacts
[
contact
].
photo
}
key
=
{
contact
}
/
>
})
}
render
()
{
return
(
<>
{
this
.
props
.
contacts
?
<
div
className
=
'Contacts'
>
{
this
.
printContacts
()}
<
/div> : null
}
{
this
.
state
.
selectContact
?
<
Modal
show
=
{
true
}
>
<>
<
div
>
{
this
.
props
.
contacts
[
this
.
state
.
selectContact
].
email
}
<
/div
>
<
div
>
{
this
.
props
.
contacts
[
this
.
state
.
selectContact
].
name
}
<
/div
>
<
div
>
{
this
.
props
.
contacts
[
this
.
state
.
selectContact
].
phone
}
<
/div
>
<
NavLink
to
=
{
`/contacts/edit/
${
this
.
state
.
selectContact
}
`
}
>
edit
<
/NavLink
>
<
/
>
<
/Modal
>
:
null
}
<
/
>
);
}
}
const
mapStateToProps
=
state
=>
{
return
{
contacts
:
state
.
contacts
}
};
const
mapDispatchToProps
=
dispatch
=>
{
return
{
getContacts
:
()
=>
dispatch
(
getContacts
())
}
};
export
default
connect
(
mapStateToProps
,
mapDispatchToProps
)(
Contacts
);
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