Anuj-Panthri commited on
Commit
12ef2c2
·
1 Parent(s): 88b9eae

added Contact component

Browse files
src/App.css CHANGED
@@ -1,19 +1,23 @@
1
  .App {
2
- height:100vh;
3
- display:flex;
4
  /* align-items: stretch; */
5
  }
6
 
7
- .contacts{
8
  background-color: rgb(115, 40, 214);
9
- color:white;
10
- min-width:300px;
11
-
12
- display:flex;
 
 
13
  flex-direction: column;
14
  align-items: center;
15
  }
16
 
17
- .chat{
18
  background-color: rgb(255, 255, 255);
 
 
19
  }
 
1
  .App {
2
+ height: 100vh;
3
+ display: flex;
4
  /* align-items: stretch; */
5
  }
6
 
7
+ .contacts {
8
  background-color: rgb(115, 40, 214);
9
+ color: white;
10
+ width: 300px;
11
+
12
+ flex-shrink: 0;
13
+ /* overflow:hidden; */
14
+ display: flex;
15
  flex-direction: column;
16
  align-items: center;
17
  }
18
 
19
+ .chat {
20
  background-color: rgb(255, 255, 255);
21
+ height: 100%;
22
+ width: -webkit-fill-available;
23
  }
src/components/Chat/Chat.css CHANGED
@@ -1,6 +1,4 @@
1
  .chat{
2
- height:100%;
3
- width:100%;
4
  display:flex;
5
  flex-direction: column;
6
  background-color: rgb(208, 208, 208);
 
1
  .chat{
 
 
2
  display:flex;
3
  flex-direction: column;
4
  background-color: rgb(208, 208, 208);
src/components/Contact/Contact.css ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .contact{
2
+ height:70px;
3
+ width:100%;
4
+ padding:0.8em;
5
+ display:flex;
6
+ align-items: center;
7
+ column-gap: 1em;
8
+ border-bottom:2px solid rgba(179, 179, 179, 0.41) ;
9
+ overflow: hidden;
10
+ }
11
+
12
+
13
+ .contact.active{
14
+ background-color: rgba(179, 179, 179, 0.41);
15
+ border-color:transparent;
16
+
17
+ }
18
+
19
+ .contact:last-child{
20
+ border:none;
21
+ }
22
+
23
+ .contact>div{
24
+ width:70%;
25
+ /* background-color: black; */
26
+ height:100%;
27
+ }
28
+
29
+ .contact__img{
30
+ height:100%;
31
+ aspect-ratio: 1;
32
+ background-color: aliceblue;
33
+ border-radius: 50%;
34
+
35
+ }
36
+
37
+ .contact__name{
38
+ text-transform: capitalize;
39
+ overflow: hidden;
40
+ text-overflow: ellipsis;
41
+ }
42
+
43
+ .contact__lastmsg{
44
+ /* display: none; */
45
+ overflow: hidden;
46
+ text-overflow: ellipsis;
47
+ color:rgb(234, 234, 234);
48
+ font-size:0.9em;
49
+ white-space: nowrap;
50
+ }
src/components/Contact/Contact.jsx CHANGED
@@ -1,8 +1,24 @@
1
  import React from 'react'
 
 
 
 
 
 
 
 
 
2
 
3
- function Contact() {
4
  return (
5
- <div>Contact</div>
 
 
 
 
 
 
 
 
6
  )
7
  }
8
 
 
1
  import React from 'react'
2
+ import "./Contact.css";
3
+
4
+ function Contact({
5
+ profile_pic,
6
+ name,
7
+ lastmessage = "",
8
+ isActive = false,
9
+ }) {
10
+
11
 
 
12
  return (
13
+ <div className={(isActive?"active":"")+' contact'}>
14
+ <img src={profile_pic} className='contact__img' />
15
+ <div>
16
+ <h4 className='contact__name'>{name}</h4>
17
+ {lastmessage != "" &&
18
+ <p className='contact__lastmsg'>{lastmessage}</p>
19
+ }
20
+ </div>
21
+ </div>
22
  )
23
  }
24
 
src/components/Contacts/Contacts.jsx CHANGED
@@ -7,9 +7,15 @@ function Contacts() {
7
  <div className='contacts'>
8
 
9
  <Search />
10
-
11
- <Contact />
12
- <Contact />
 
 
 
 
 
 
13
  </div>
14
  )
15
  }
 
7
  <div className='contacts'>
8
 
9
  <Search />
10
+
11
+ <Contact profile_pic={"logo512.png"} name={"anuj"} lastmessage={"good morning"} />
12
+ <Contact
13
+ profile_pic={"https://image.cdn2.seaart.ai/2023-06-26/38717300371525/37c6db0143cbddb29c5cba13783ee5b67f5a2c8b_low.webp"}
14
+ name={"Kathrina"}
15
+ lastmessage={"Well this is a long messageWell this is a long messageWell this is a long messageWell this is a long messageWell this is a long messageWell this is a long messageWell this is a long messageWell this is a long message"}
16
+ />
17
+ <Contact profile_pic={"logo512.png"} name={"anuj"} lastmessage={"good morning"}/>
18
+ <Contact profile_pic={"logo512.png"} name={"anuj"} lastmessage={"good morning"} />
19
  </div>
20
  )
21
  }
src/components/Search/Search.css CHANGED
@@ -1,18 +1,21 @@
1
  .search{
 
2
  background-color: #fff;
3
  border-radius: 50px;
4
 
5
  display:flex;
6
  align-items: center;
 
7
  overflow:hidden;
8
 
9
  margin:2em 0;
10
- padding:0.5em;
11
  }
12
 
13
  .search>input{
14
  border:none;
15
  outline:none;
 
16
  /* padding:0.5em; */
17
  }
18
 
 
1
  .search{
2
+ width: 80%;
3
  background-color: #fff;
4
  border-radius: 50px;
5
 
6
  display:flex;
7
  align-items: center;
8
+ justify-content: center;
9
  overflow:hidden;
10
 
11
  margin:2em 0;
12
+ padding:0.5em 0.8em;
13
  }
14
 
15
  .search>input{
16
  border:none;
17
  outline:none;
18
+ flex-grow: 1;
19
  /* padding:0.5em; */
20
  }
21