-
-
Save antonkomarev/5ecabf981b30bc79dd87 to your computer and use it in GitHub Desktop.
Style to https://github.com/cmgmyr/laravel-messenger with differentiate senders and receiver.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.mensagens-chat | |
{ | |
list-style: none; | |
margin: 0; | |
padding: 0; | |
} | |
.mensagens-chat li | |
{ | |
margin-bottom: 10px; | |
padding: 15px 0; | |
border-bottom: 1px dotted #eee; | |
} | |
.mensagens-chat li:last-child | |
{ | |
border-bottom: 0; | |
} | |
.mensagens-chat li.left .mensagens-chat-body | |
{ | |
margin-left: 70px; | |
} | |
.mensagens-chat li.right .mensagens-chat-body | |
{ | |
margin-right: 70px; | |
} | |
.mensagens-chat li .mensagens-chat-body p | |
{ | |
margin: 0; | |
color: #777777; | |
} | |
.mensagens-chat li .mensagens-chat-body .header{ | |
margin-bottom: 15px; | |
margin-top: -14px; | |
} | |
.mensagens-chat .glyphicon | |
{ | |
margin-right: 5px; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ul class="mensagens-chat"> | |
<?php $mensagemAnterior = null; ?> | |
@foreach($thread->messages as $message) | |
<?php $class = Auth::user()->id == $message->user->id ? 'right' : 'left'; ?> | |
<?php $class2 = $class == 'right' ? 'left' : 'right'; ?> | |
@if ($mensagemAnterior == $message->user->id) | |
<li class="{{$class}} clearfix mesmo_user"> | |
<span class="mensagens-chat-img pull-{{$class}}"></span> | |
<div class="mensagens-chat-body clearfix"> | |
<div class="header"> | |
<strong class="primary-font"> </strong> | |
<small class="pull-{{$class2}} text-muted"> | |
<span class="glyphicon glyphicon-time"></span>{{$message->created_at->diffForHumans()}} | |
</small> | |
</div> | |
<p> | |
{{$message->body}} | |
</p> | |
</div> | |
</li> | |
@else | |
<li class="{{$class}} clearfix"> | |
<span class="mensagens-chat-img pull-{{$class}}"> | |
<img src="//www.gravatar.com/avatar/{!! md5($message->user->email) !!}?s=64" alt="{!! $message->user->name !!}" class="pull-{{$class}} img-circle"> | |
</span> | |
<div class="mensagens-chat-body clearfix"> | |
<div class="header"> | |
<strong class="primary-font">{{ $message->user->name }}</strong> | |
<small class="pull-{{$class2}} text-muted"> | |
<span class="glyphicon glyphicon-time"></span>{{$message->created_at->diffForHumans()}} | |
</small> | |
</div> | |
<p> | |
{{$message->body}} | |
</p> | |
</div> | |
</li> | |
@endif | |
<?php $mensagemAnterior = $message->user->id?> | |
@endforeach | |
</ul> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment