@extends('app')

@section('content')
<div class="container">
	<div class="row">
		<div class="ui segment teal  inverted">
				<h2 class="ui header">
                  <i class="cube icon"></i>
                  <div class="content">
                        Behold! this blog
                    <div class="sub header">welcome</div>
                  </div>
                </h2>

			</div>
			<div class="ui segment attached">
			   <span class="ui header"> Featured Posts </span> 
               <a href="https://github.com/jjdd12/blog" class="ui  button right floated inverted orange"><i class="github black large icon"></i> Source</a>
               <a href="{{ url('post/feed') }}" class="ui  button right floated inverted orange"><i class="rss large icon"></i> Feed</a>
               <a href="{{ url('post')}}" class="ui button right floated large teal it">See all posts</a>
               
            </div>
			<div class="ui attached segment items">
			     @foreach( $posts as $post) 
       
            <div class="post item">
                 @if($post['featured_image'])
                 <div class="image">
                    <img src="{{$post['featured_image']}}175/145/" alt="">
                </div>
                @endif
                <div class="content">
                <h1 class="title header">
                   <a href="post/{{ $post['id'] }}"> {{ $post['title'] }} </a> 
                    </h1>
                   <span class="comments_count">{{ count($post->comments) }} comments </span>            
                <div class="description">
                   <p>
                    {!! $post['read_more'] !!}
                    </p>
                </div>
                <div class="extra">
                     <a class="ui button right floated teal mini " href="post/{{ $post['id'] }}">Read More</a>
                </div>
                </div>
               
            </div>
    @endforeach 
    </div>
	</div>
</div>
@endsection
