|
| 1 | +<?php |
| 2 | + |
| 3 | +namespace App\View\Components\Docs; |
| 4 | + |
| 5 | +use Closure; |
| 6 | +use Illuminate\Contracts\View\View; |
| 7 | +use Illuminate\View\Component; |
| 8 | + |
| 9 | +class Banner extends Component |
| 10 | +{ |
| 11 | + public string $title; |
| 12 | + public string $image; |
| 13 | + public string $href; |
| 14 | + |
| 15 | + /** |
| 16 | + * Create a new component instance. |
| 17 | + */ |
| 18 | + public function __construct() |
| 19 | + { |
| 20 | + $banner = collect([ |
| 21 | + [ |
| 22 | + 'title' => 'Поделитесь своим кодом и идеями!', |
| 23 | + 'image' => asset('/img/ui/doc-banners/pastebin.svg'), |
| 24 | + 'href' => route('pastebin'), |
| 25 | + ], |
| 26 | + [ |
| 27 | + 'title' => 'Поддержите нас - каждый вклад важен!', |
| 28 | + 'image' => asset('/img/ui/doc-banners/donate.svg'), |
| 29 | + 'href' => route('donate'), |
| 30 | + ], |
| 31 | + [ |
| 32 | + 'title' => 'Будьте в курсе последних новостей!', |
| 33 | + 'image' => asset('/img/ui/doc-banners/feed.svg'), |
| 34 | + 'href' => route('feed'), |
| 35 | + ], |
| 36 | + [ |
| 37 | + 'title' => 'Ищете работу? Мы поможем!', |
| 38 | + 'image' => asset('/img/ui/doc-banners/jobs.svg'), |
| 39 | + 'href' => route('jobs'), |
| 40 | + ], |
| 41 | + [ |
| 42 | + 'title' => 'Примите наш вызов и улучшите свои навыки!', |
| 43 | + 'image' => asset('/img/ui/doc-banners/challenges.svg'), |
| 44 | + 'href' => route('challenges'), |
| 45 | + ] |
| 46 | + ])->random(); |
| 47 | + |
| 48 | + $this->title = $banner['title']; |
| 49 | + $this->image = $banner['image']; |
| 50 | + $this->href = $banner['href']; |
| 51 | + } |
| 52 | + |
| 53 | + /** |
| 54 | + * Get the view / contents that represent the component. |
| 55 | + */ |
| 56 | + public function render(): View|Closure|string |
| 57 | + { |
| 58 | + return view('components.docs.banner'); |
| 59 | + } |
| 60 | +} |
0 commit comments