Skip to content

Commit bd0be2e

Browse files
dotansimhadarkbasic
authored andcommitted
Step 6.9: Style the message component
1 parent 7b0c92c commit bd0be2e

File tree

2 files changed

+107
-1
lines changed

2 files changed

+107
-1
lines changed

src/pages/messages/messages.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
<ion-content padding class="messages-page-content">
1717
<ion-scroll scrollY="true" class="messages">
18-
<div *ngFor="let message of messages | async" class="day-wrapper">
18+
<div *ngFor="let message of messages | async" class="message-wrapper">
1919
<div [class]="'message message-' + message.ownership">
2020
<div *ngIf="message.type == 'text'" class="message-content message-content-text">{{message.content}}</div>
2121
<span class="message-timestamp">{{ message.createdAt }}</span>

src/pages/messages/messages.scss

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
.messages-page-navbar {
2+
.chat-picture {
3+
width: 50px;
4+
border-radius: 50%;
5+
float: left;
6+
}
7+
8+
.chat-title {
9+
line-height: 50px;
10+
float: left;
11+
}
12+
}
13+
14+
.messages-page-content {
15+
> .scroll-content {
16+
margin: 42px -16px 42px !important;
17+
}
18+
19+
.day-wrapper .day-timestamp {
20+
margin-left: calc(50% - 64px);
21+
margin-right: calc(50% - 64px);
22+
margin-bottom: 9px;
23+
text-align: center;
24+
line-height: 27px;
25+
height: 27px;
26+
border-radius: 3px;
27+
color: gray;
28+
box-shadow: 0 1px 2px rgba(0, 0, 0, .15);
29+
background: #d9effa;
30+
}
31+
32+
.messages {
33+
height: 100%;
34+
background-image: url(../assets/chat-background.jpg);
35+
background-color: #E0DAD6;
36+
background-repeat: no-repeat;
37+
background-size: cover;
38+
}
39+
40+
.message-wrapper {
41+
margin-bottom: 9px;
42+
43+
&::after {
44+
content: "";
45+
display: table;
46+
clear: both;
47+
}
48+
}
49+
50+
.message {
51+
display: inline-block;
52+
position: relative;
53+
max-width: 65vh;
54+
border-radius: 7px;
55+
box-shadow: 0 1px 2px rgba(0, 0, 0, .15);
56+
57+
&.message-mine {
58+
float: right;
59+
background-color: #DCF8C6;
60+
61+
&::before {
62+
right: -11px;
63+
background-image: url(../assets/message-mine.png)
64+
}
65+
}
66+
67+
&.message-other {
68+
float: left;
69+
background-color: #FFF;
70+
71+
&::before {
72+
left: -11px;
73+
background-image: url(../assets/message-other.png)
74+
}
75+
}
76+
77+
&.message-other::before, &.message-mine::before {
78+
content: "";
79+
position: absolute;
80+
bottom: 3px;
81+
width: 12px;
82+
height: 19px;
83+
background-position: 50% 50%;
84+
background-repeat: no-repeat;
85+
background-size: contain;
86+
}
87+
88+
.message-content {
89+
padding: 5px 7px;
90+
word-wrap: break-word;
91+
92+
&::after {
93+
content: " \00a0\00a0\00a0\00a0\00a0\00a0\00a0\00a0\00a0\00a0\00a0\00a0\00a0\00a0\00a0\00a0\00a0\00a0\00a0";
94+
display: inline;
95+
}
96+
}
97+
98+
.message-timestamp {
99+
position: absolute;
100+
bottom: 2px;
101+
right: 7px;
102+
font-size: 12px;
103+
color: gray;
104+
}
105+
}
106+
}

0 commit comments

Comments
 (0)