質問編集履歴

1

html css追加

2020/09/20 11:17

投稿

miki623
miki623

スコア5

test CHANGED
File without changes
test CHANGED
@@ -31,3 +31,271 @@
31
31
  どなたかお詳しい方、ご教示いただけないでしょうか。
32
32
 
33
33
  何卒よろしくお願いいたします。
34
+
35
+
36
+
37
+ ```ruby
38
+
39
+ <div class="comments">
40
+
41
+ <h4>チャット一覧</h4>
42
+
43
+ <div class="comment-inner">
44
+
45
+ <% if seller_signed_in? %>
46
+
47
+ <% @comments.each do |comment| %>
48
+
49
+ <% if comment.seller_id.present? %>
50
+
51
+ <div class="comment-right">
52
+
53
+ <p class="comment-nickname">
54
+
55
+ <%= comment.seller.nickname %>
56
+
57
+ </p>
58
+
59
+ <div class="chat-text-right">
60
+
61
+ <p class="chat-comment-right">
62
+
63
+ <%= comment.text %>
64
+
65
+ </p>
66
+
67
+ </div>
68
+
69
+ <span>
70
+
71
+ <%= image_tag comment.image.variant(resize:'350x350'), class: "comment-image" if comment.image.attached? %>
72
+
73
+ </span>
74
+
75
+ </div>
76
+
77
+ <% else %>
78
+
79
+ <div class="comment-left">
80
+
81
+ <p class="comment-nickname">
82
+
83
+ <%= comment.buyer.nickname %>
84
+
85
+ </p>
86
+
87
+ <div class="chat-text-left">
88
+
89
+ <p class="chat-comment-left">
90
+
91
+ <%= comment.text %>
92
+
93
+ </p>
94
+
95
+ </div>
96
+
97
+ <p>
98
+
99
+ <%= image_tag comment.image.variant(resize:'350x350'), class: "comment-image" if comment.image.attached? %>
100
+
101
+ </p>
102
+
103
+ </div>
104
+
105
+ <% end %>
106
+
107
+ <% end %>
108
+
109
+ <%elsif buyer_signed_in?%>
110
+
111
+ <% @comments.each do |comment| %>
112
+
113
+ <% if comment.buyer_id.present? %>
114
+
115
+ <div class="comment-right">
116
+
117
+ <p class="comment-nickname">
118
+
119
+ <%= comment.buyer.nickname %>
120
+
121
+ </p>
122
+
123
+ <div class="chat-text-right">
124
+
125
+ <p class="chat-comment-right">
126
+
127
+ <%= comment.text %>
128
+
129
+ </p>
130
+
131
+ </div>
132
+
133
+ <p>
134
+
135
+ <%= image_tag comment.image.variant(resize:'350x350'), class: "comment-image" if comment.image.attached? %>
136
+
137
+ </p>
138
+
139
+ </div>
140
+
141
+ <% else %>
142
+
143
+ <div class="comment-left">
144
+
145
+ <p class="comment-nickname">
146
+
147
+ <%= comment.seller.nickname %>
148
+
149
+ </p>
150
+
151
+ <div class="chat-text-left">
152
+
153
+ <p class="chat-comment-left">
154
+
155
+ <%= comment.text %>
156
+
157
+ </p>
158
+
159
+ </div>
160
+
161
+ <p>
162
+
163
+ <%= image_tag comment.image.variant(resize:'350x350'), class: "comment-image" if comment.image.attached? %>
164
+
165
+ </p>
166
+
167
+ </div>
168
+
169
+ <% end %>
170
+
171
+ <% end %>
172
+
173
+ <% end %>
174
+
175
+ </div>
176
+
177
+ </div>
178
+
179
+
180
+
181
+ ```
182
+
183
+
184
+
185
+ ```css
186
+
187
+
188
+
189
+ .comment-right {
190
+
191
+ text-align: right;
192
+
193
+ }
194
+
195
+
196
+
197
+ .comment-left {
198
+
199
+ text-align: left;
200
+
201
+ }
202
+
203
+
204
+
205
+ .chat-text-right {
206
+
207
+ position: relative;
208
+
209
+ display: inline-block;
210
+
211
+ margin: 1.5em 15px 1.5em 0;
212
+
213
+ padding: 7px 10px;
214
+
215
+ min-width: 120px;
216
+
217
+ max-width: 500px;
218
+
219
+ color: rgb(51, 51, 51);
220
+
221
+ font-size: 16px;
222
+
223
+ background: #e0edff;
224
+
225
+ border-radius: 10px;
226
+
227
+ word-wrap: break-word;
228
+
229
+ }
230
+
231
+
232
+
233
+ .chat-text-right:before {
234
+
235
+ content: "";
236
+
237
+ position: absolute;
238
+
239
+ top: 50%;
240
+
241
+ left: 100%;
242
+
243
+ margin-top: -15px;
244
+
245
+ border: 15px solid transparent;
246
+
247
+ border-left: 15px solid #e0edff;
248
+
249
+ }
250
+
251
+
252
+
253
+ .chat-text-left {
254
+
255
+ position: relative;
256
+
257
+ display: inline-block;
258
+
259
+ margin: 1.5em 0 1.5em 15px;
260
+
261
+ padding: 7px 10px;
262
+
263
+ min-width: 120px;
264
+
265
+ max-width: 500px;
266
+
267
+ color: rgb(51, 51, 51);
268
+
269
+ font-size: 16px;
270
+
271
+ background: #e0edff;
272
+
273
+ border-radius: 10px;
274
+
275
+ word-wrap: break-word;
276
+
277
+ }
278
+
279
+
280
+
281
+ .chat-text-left:before {
282
+
283
+ content: "";
284
+
285
+ position: absolute;
286
+
287
+ top: 50%;
288
+
289
+ left: -30px;
290
+
291
+ margin-top: -15px;
292
+
293
+ border: 15px solid transparent;
294
+
295
+ border-right: 15px solid #e0edff;
296
+
297
+ }
298
+
299
+
300
+
301
+ ```