mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-05-23 07:10:00 +08:00
Updated grid view to use CSS grid and flexbox
Provides a cleaner height-matched design. Closes #701
This commit is contained in:
@ -36,7 +36,7 @@ class BookController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
$books = $this->entityRepo->getAllPaginated('book', 20);
|
$books = $this->entityRepo->getAllPaginated('book', 18);
|
||||||
$recents = $this->signedIn ? $this->entityRepo->getRecentlyViewed('book', 4, 0) : false;
|
$recents = $this->signedIn ? $this->entityRepo->getRecentlyViewed('book', 4, 0) : false;
|
||||||
$popular = $this->entityRepo->getPopular('book', 4, 0);
|
$popular = $this->entityRepo->getPopular('book', 4, 0);
|
||||||
$new = $this->entityRepo->getRecentlyCreated('book', 4, 0);
|
$new = $this->entityRepo->getRecentlyCreated('book', 4, 0);
|
||||||
|
@ -175,6 +175,43 @@ div[class^="col-"] img {
|
|||||||
margin-right: -$-m;
|
margin-right: -$-m;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.grid {
|
||||||
|
display: grid;
|
||||||
|
grid-column-gap: $-l;
|
||||||
|
grid-row-gap: $-l;
|
||||||
|
&.third {
|
||||||
|
grid-template-columns: 1fr 1fr 1fr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.grid-card {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
border: 1px solid #ddd;
|
||||||
|
min-width: 100px;
|
||||||
|
.grid-card-content {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
.grid-card-content, .grid-card-footer {
|
||||||
|
padding: $-l;
|
||||||
|
}
|
||||||
|
.grid-card-content + .grid-card-footer {
|
||||||
|
padding-top: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@include smaller-than($m) {
|
||||||
|
.grid.third {
|
||||||
|
grid-template-columns: 1fr 1fr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@include smaller-than($s) {
|
||||||
|
.grid.third {
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.float {
|
.float {
|
||||||
float: left;
|
float: left;
|
||||||
&.right {
|
&.right {
|
||||||
@ -195,14 +232,6 @@ div[class^="col-"] img {
|
|||||||
display: inline-block;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
|
|
||||||
@include larger-than(991px) {
|
|
||||||
.row.auto-clear .col-md-4:nth-child(3n+1){clear:left;}
|
|
||||||
}
|
|
||||||
|
|
||||||
@include smaller-than(992px) {
|
|
||||||
.row.auto-clear .col-xs-6:nth-child(2n+1){clear:left;}
|
|
||||||
}
|
|
||||||
|
|
||||||
.col-xs-1, .col-sm-1, .col-md-1, .col-lg-1, .col-xs-2, .col-sm-2, .col-md-2, .col-lg-2, .col-xs-3, .col-sm-3, .col-md-3, .col-lg-3, .col-xs-4, .col-sm-4, .col-md-4, .col-lg-4, .col-xs-5, .col-sm-5, .col-md-5, .col-lg-5, .col-xs-6, .col-sm-6, .col-md-6, .col-lg-6, .col-xs-7, .col-sm-7, .col-md-7, .col-lg-7, .col-xs-8, .col-sm-8, .col-md-8, .col-lg-8, .col-xs-9, .col-sm-9, .col-md-9, .col-lg-9, .col-xs-10, .col-sm-10, .col-md-10, .col-lg-10, .col-xs-11, .col-sm-11, .col-md-11, .col-lg-11, .col-xs-12, .col-sm-12, .col-md-12, .col-lg-12 {
|
.col-xs-1, .col-sm-1, .col-md-1, .col-lg-1, .col-xs-2, .col-sm-2, .col-md-2, .col-lg-2, .col-xs-3, .col-sm-3, .col-md-3, .col-lg-3, .col-xs-4, .col-sm-4, .col-md-4, .col-lg-4, .col-xs-5, .col-sm-5, .col-md-5, .col-lg-5, .col-xs-6, .col-sm-6, .col-md-6, .col-lg-6, .col-xs-7, .col-sm-7, .col-md-7, .col-lg-7, .col-xs-8, .col-sm-8, .col-md-8, .col-lg-8, .col-xs-9, .col-sm-9, .col-md-9, .col-lg-9, .col-xs-10, .col-sm-10, .col-md-10, .col-lg-10, .col-xs-11, .col-sm-11, .col-md-11, .col-lg-11, .col-xs-12, .col-sm-12, .col-md-12, .col-lg-12 {
|
||||||
position: relative;
|
position: relative;
|
||||||
min-height: 1px;
|
min-height: 1px;
|
||||||
|
@ -382,13 +382,15 @@ ul.pagination {
|
|||||||
position: relative;
|
position: relative;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
background: #F2F2F2;
|
background: #F2F2F2;
|
||||||
border: 1px solid #ddd;
|
a {
|
||||||
border-bottom: 0;
|
display: block;
|
||||||
|
}
|
||||||
img {
|
img {
|
||||||
display: block;
|
display: block;
|
||||||
|
width: 100%;
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
height: auto;
|
height: auto;
|
||||||
transition: all .5s ease;
|
transition: all .5s ease-in-out;
|
||||||
}
|
}
|
||||||
img:hover {
|
img:hover {
|
||||||
transform: scale(1.15);
|
transform: scale(1.15);
|
||||||
@ -396,31 +398,33 @@ ul.pagination {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.book-grid-content {
|
.book-grid-item .grid-card-content {
|
||||||
padding: 30px;
|
|
||||||
border: 1px solid #ddd;
|
|
||||||
border-top: 0;
|
border-top: 0;
|
||||||
border-bottom-width: 2px;
|
border-bottom-width: 2px;
|
||||||
h2 {
|
h2 {
|
||||||
|
width: 100%;
|
||||||
font-size: 1.5em;
|
font-size: 1.5em;
|
||||||
margin: 0 0 10px;
|
margin: 0 0 10px;
|
||||||
}
|
}
|
||||||
h2 a {
|
h2 a {
|
||||||
display: block;
|
display: block;
|
||||||
|
width: 100%;
|
||||||
line-height: 1.2;
|
line-height: 1.2;
|
||||||
color: #009688;;
|
color: #009688;;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
|
white-space: pre-wrap; /* css-3 */
|
||||||
|
word-wrap: break-word; /* Internet Explorer 5.5+ */
|
||||||
}
|
}
|
||||||
p {
|
p {
|
||||||
font-size: .85em;
|
font-size: .85em;
|
||||||
margin: 0 0 10px;
|
margin: 0;
|
||||||
line-height: 1.6em;
|
line-height: 1.6em;
|
||||||
}
|
}
|
||||||
p.small {
|
|
||||||
font-size: .8em;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.book-grid-item {
|
.book-grid-item .grid-card-footer {
|
||||||
margin-bottom : 20px;
|
p.small {
|
||||||
|
font-size: .8em;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,18 +1,18 @@
|
|||||||
<div class="col-xs-12 col-sm-4 col-md-4 col-lg-4 book-grid-item" data-entity-type="book" data-entity-id="{{$book->id}}">
|
<div class="book-grid-item grid-card" data-entity-type="book" data-entity-id="{{$book->id}}">
|
||||||
<div class="featured-image-container">
|
<div class="featured-image-container">
|
||||||
<a href="{{$book->getUrl()}}" title="{{$book->name}}">
|
<a href="{{$book->getUrl()}}" title="{{$book->name}}">
|
||||||
<img width="1600" height="900" src="{{$book->getBookCover()}}" alt="{{$book->name}}">
|
<img src="{{$book->getBookCover()}}" alt="{{$book->name}}">
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="book-grid-content">
|
<div class="grid-card-content">
|
||||||
<h2><a href="{{$book->getUrl()}}" title="{{$book->name}}">{{$book->getShortName(35)}}</a></h2>
|
<h2><a href="{{$book->getUrl()}}" title="{{$book->name}}">{{$book->getShortName(35)}}</a></h2>
|
||||||
@if(isset($book->searchSnippet))
|
@if(isset($book->searchSnippet))
|
||||||
<p >{!! $book->searchSnippet !!}</p>
|
<p >{!! $book->searchSnippet !!}</p>
|
||||||
@else
|
@else
|
||||||
<p >{{ $book->getExcerpt(130) }}</p>
|
<p >{{ $book->getExcerpt(130) }}</p>
|
||||||
@endif
|
@endif
|
||||||
<div >
|
</div>
|
||||||
|
<div class="grid-card-footer">
|
||||||
<span>@include('partials.entity-meta', ['entity' => $book])</span>
|
<span>@include('partials.entity-meta', ['entity' => $book])</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
@ -66,13 +66,13 @@
|
|||||||
@endforeach
|
@endforeach
|
||||||
{!! $books->render() !!}
|
{!! $books->render() !!}
|
||||||
@else
|
@else
|
||||||
<div class="row auto-clear">
|
<div class="grid third">
|
||||||
@foreach($books as $key => $book)
|
@foreach($books as $key => $book)
|
||||||
@include('books/grid-item', ['book' => $book])
|
@include('books/grid-item', ['book' => $book])
|
||||||
@endforeach
|
@endforeach
|
||||||
<div class="col-xs-12">
|
|
||||||
{!! $books->render() !!}
|
|
||||||
</div>
|
</div>
|
||||||
|
<div>
|
||||||
|
{!! $books->render() !!}
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
@else
|
@else
|
||||||
|
Reference in New Issue
Block a user