Skip to content

Commit 60420b8

Browse files
committed
Added courses for langing page
1 parent 75a9a05 commit 60420b8

File tree

9 files changed

+97
-11
lines changed

9 files changed

+97
-11
lines changed

app/School/Courses.php

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,18 @@
22

33
namespace App\School;
44

5+
use Illuminate\Support\Collection;
6+
57
class Courses
68
{
79
/**
8-
* Get the courses items.
10+
* Get the teachers items.
911
*
1012
* @return array
1113
*/
12-
public static function items(): array
14+
public static function teachers(): Collection
1315
{
14-
return [
16+
return collect([
1517
Teacher::make('Михаил Протасевич', '/img/community/protasevich.jpg', [
1618
new Course(
1719
'Laravel Reverb',
@@ -113,6 +115,18 @@ public static function items(): array
113115
'https://www.youtube.com/playlist?list=PLoonZ8wII66hKbEvIVAZnp1h4CE-4Mtk4'
114116
),
115117
]),
116-
];
118+
]);
119+
}
120+
121+
/**
122+
* Get the courses items.
123+
*
124+
* @return array
125+
*/
126+
public static function items(): Collection
127+
{
128+
return static::teachers()
129+
->map(fn(Teacher $teacher) => $teacher->courses)
130+
->flatten();
117131
}
118132
}

public/build/assets/app-DKT7jrpA.css renamed to public/build/assets/app-BEZ5dSej.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/build/assets/app-DhmmTq3Y.js renamed to public/build/assets/app-Kqr10Ojd.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/build/manifest.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
"src": "public/img/ui/warning.svg"
1313
},
1414
"resources/css/app.scss": {
15-
"file": "assets/app-DKT7jrpA.css",
15+
"file": "assets/app-BEZ5dSej.css",
1616
"src": "resources/css/app.scss",
1717
"isEntry": true
1818
},
1919
"resources/js/app.js": {
20-
"file": "assets/app-DhmmTq3Y.js",
20+
"file": "assets/app-Kqr10Ojd.js",
2121
"name": "app",
2222
"src": "resources/js/app.js",
2323
"isEntry": true,

resources/css/app.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ $utilities: (
107107
@import 'marketing';
108108
@import 'post';
109109
@import 'gagarin';
110+
@import "slider";
110111

111112
.avatar {
112113
border-radius: 10em;

resources/css/slider.scss

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
$animationSliderSpeed: 40s;
2+
3+
// Animation
4+
@keyframes scroll {
5+
0% { transform: translateX(0); }
6+
100% { transform: translateX(calc(-250px * 7))}
7+
}
8+
9+
10+
// Styling
11+
.slider {
12+
margin: auto;
13+
overflow:hidden;
14+
position: relative;
15+
width: 100%;
16+
17+
&::before,
18+
&::after {
19+
background: linear-gradient(to right, var(--bs-body-bg) 0%,rgba(255,255,255,0) 100%);
20+
content: "";
21+
height: 100%;
22+
position: absolute;
23+
width: 200px;
24+
z-index: 2;
25+
pointer-events: none;
26+
}
27+
28+
&::after {
29+
right: 0;
30+
top: 0;
31+
transform: rotateZ(180deg);
32+
}
33+
34+
&::before {
35+
left: 0;
36+
top: 0;
37+
}
38+
39+
.slide-track {
40+
animation: scroll $animationSliderSpeed linear infinite;
41+
display: flex;
42+
width: calc(250px * 14);
43+
}
44+
45+
.slide {
46+
min-width: 250px;
47+
width: 20rem;
48+
}
49+
}

resources/views/pages/courses.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ class="link-body-emphasis text-decoration-none icon-link icon-link-hover stretch
339339
</div>
340340
</div>
341341

342-
@foreach($teachers as $key => $teacher)
342+
@foreach(\App\School\Courses::teachers() as $key => $teacher)
343343

344344
<div class="row g-0 rounded bg-body-tertiary mb-5">
345345
<div class="col-lg-4 {{ $key % 2 === 0 ? 'order-lg-last' : '' }}">

resources/views/pages/welcome.blade.php

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,29 @@ class="stretched-link link-light text-decoration-none">Railt</a></h3>
384384

385385
@include('particles.sponsors')
386386

387+
<x-container class="mt-5 py-5">
388+
<div class="slider rounded">
389+
<div class="slide-track">
390+
@foreach(\App\School\Courses::items()->shuffle() as $key => $course)
391+
<div class="col-12 col-md-6 col-lg-4 col-sm-2 mx-3 slide">
392+
<div
393+
class="d-grid gap-4 d-flex align-items-center position-relative rounded bg-body-tertiary h-100 p-3">
394+
<img src="{{ $course->image }}" height="80">
395+
<a href="{{ $course->link }}" rel="nofollow"
396+
target="_blank"
397+
class="link-body-emphasis stretched-link text-decoration-none text-balance">
398+
<p class="h6 mb-2">{{ $course->name }}</p>
399+
<p class="opacity-75 line-clamp line-clamp-3 small">
400+
{{ $course->description }}
401+
</p>
402+
</a>
403+
</div>
404+
</div>
405+
@endforeach
406+
</div>
407+
</div>
408+
</x-container>
409+
387410
<div class="container mt-5 py-5">
388411
<div class="row g-4 g-md-5 align-items-center justify-content-between">
389412
<div class="col-xl-7 col-md-6 order-2 order-md-1">
@@ -529,7 +552,6 @@ class="link-body-emphasis fw-semibold text-decoration-none icon-link icon-link-h
529552

530553

531554

532-
533555
<div class="container mt-5 py-5">
534556

535557
<div class="row g-4 g-md-5 justify-content-center align-items-end mb-5">

routes/web.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
Route::view('/donate', 'pages.donate')->name('donate');
3838
Route::view('/donate/frame', 'pages.donate-frame')->name('donate.frame');
3939

40-
Route::view('/courses', 'pages.courses', ['teachers' => \App\School\Courses::items()])->name('courses');
40+
Route::view('/courses', 'pages.courses')->name('courses');
4141
Route::view('/assets', 'pages.assets')->name('assets');
4242
Route::view('/boilerplate', 'pages.boilerplate')->name('boilerplate');
4343

0 commit comments

Comments
 (0)