-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #311 from FitzwilliamMuseum/issue-310-carousel-cha…
…nges Change carousels on landing page
- Loading branch information
Showing
9 changed files
with
254 additions
and
221 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
namespace App\View\Components; | ||
|
||
use Illuminate\View\Component; | ||
|
||
class carouselSlide extends Component | ||
{ | ||
public array $slides; | ||
public string $class; | ||
public string $imageObject; | ||
public string $title; | ||
public string $route; | ||
public string $param; | ||
public bool $slugify; | ||
/** | ||
* Create a new component instance. | ||
* | ||
* @return void | ||
*/ | ||
public function __construct(array $slides, string $class, string $imageObject, string $title, string $route, string $param, bool $slugify) | ||
{ | ||
$this->slides = $slides; | ||
$this->class = $class; | ||
$this->imageObject = $imageObject; | ||
$this->title = $title; | ||
$this->route = $route; | ||
$this->param = $param; | ||
$this->slugify = $slugify; | ||
} | ||
|
||
/** | ||
* Get the view / contents that represent the component. | ||
* | ||
* @return \Illuminate\Contracts\View\View|\Closure|string | ||
*/ | ||
public function render() | ||
{ | ||
return view('components.carousel-slide'); | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<div class="carousel-item {{ $class }}"> | ||
<div class="row"> | ||
@foreach($slides as $slide) | ||
@if(array_key_exists('0',$slide)) | ||
<div class="col-md-4 mb-3"> | ||
<div class="card"> | ||
@if($slugify) | ||
<a href="{{ route($route, Str::slug($slide[0][$param],'-')) }}" class="stretched-link"> | ||
<img class="card-img-top" alt="{{$slide[0][$title]}}" | ||
src="{{ $slide[0][$imageObject]['data']['thumbnails'][13]['url'] }}"> | ||
</a> | ||
@else | ||
<a href="{{ route($route, $slide[0][$param]) }}" class="stretched-link"> | ||
<img class="card-img-top" alt="{{$slide[0][$title]}}" | ||
src="{{ $slide[0][$imageObject]['data']['thumbnails'][13]['url'] }}"> | ||
</a> | ||
@endif | ||
<div class="card-body"> | ||
<h3 class="card-title"> | ||
@if($slugify) | ||
<a href="{{ route($route, Str::slug($slide[0][$param],'-')) }}" | ||
class="stretched-link"> | ||
{{ ucfirst(str_replace('-',' ', $slide[0][$title])) }} | ||
</a> | ||
@else | ||
<a href="{{ route($route, $slide[0][$param]) }}" class="stretched-link"> | ||
{{ ucfirst(str_replace('-',' ', $slide[0][$title])) }} | ||
</a> | ||
@endif | ||
</h3> | ||
</div> | ||
</div> | ||
</div> | ||
@else | ||
<div class="col-md-4 mb-3"> | ||
<div class="card"> | ||
@if($slugify) | ||
<a href="{{ route($route, Str::slug($slide[$param],'-')) }}" class="stretched-link"> | ||
<img class="card-img-top" alt="{{$slide[$title]}}" | ||
src="{{ $slide[$imageObject]['data']['thumbnails'][13]['url'] }}"> | ||
</a> | ||
@else | ||
<a href="{{ route($route, $slide[$param]) }}" class="stretched-link"> | ||
<img class="card-img-top" alt="{{$slide[$title]}}" | ||
src="{{ $slide[$imageObject]['data']['thumbnails'][13]['url'] }}"> | ||
|
||
</a> | ||
@endif | ||
<div class="card-body"> | ||
<h3 class="card-title"> | ||
@if($slugify) | ||
<a href="{{ route($route, Str::slug($slide[$param],'-')) }}" class="stretched-link"> | ||
{{ ucfirst(str_replace('-',' ', $slide[$title])) }} | ||
</a> | ||
@else | ||
<a href="{{ route($route, $slide[$param]) }}" class="stretched-link"> | ||
{{ ucfirst(str_replace('-',' ', $slide[$title])) }} | ||
</a> | ||
@endif | ||
</h3> | ||
</div> | ||
</div> | ||
</div> | ||
@endif | ||
@endforeach | ||
</div> | ||
</div> |
Oops, something went wrong.