@@ -61,7 +61,158 @@ class="text-capitalize nav-link {{ $key === 0 ? 'active' : '' }}" tabindex="-1">
61
61
<x-frontend .info-card :$info />
62
62
@endforeach
63
63
</x-frontend .info-section >
64
- <x-frontend .testimonial-section :$reviews />
64
+ {{-- @dd($reviews) --}}
65
+ <section class =" mt-5 py-5" style =" background : #474646 ;" >
66
+ <h3 class =" text-center text-light" >Testimonials</h3 >
67
+ <div class =" scroll-wrapper" >
68
+ <span id =" next" class =" ti-arrow-circle-left custom-icon" ></span >
69
+ <div class =" media-scroller snaps-inline" >
70
+ @forelse ($reviews as $item )
71
+ <div class =" media-elements" >
72
+ <img loading =" lazy" src =" {{ useImage ($item -> avatar ) } }" alt =" img" width =" 48px" height =" 48px"
73
+ class =" rounded-circle shadow-4-strong d-block" >
74
+ <div >
75
+ <div class =" mb-2" >
76
+ <h5 class =" mb-0" >{{ $item -> name } } </h5 >
77
+ <small >{{ Carbon \Carbon:: parse ($item -> created_at )-> diffForHumans () } } </small >
78
+ @if ($item -> rating )
79
+ <div class =" rating" >
80
+ @foreach (range (1 , 5 ) as $rating )
81
+ @php
82
+ $color = $rating > $item -> rating ? ' var(--bs-gray-200)' : ' var(--bs-yellow)' ;
83
+ @endphp
84
+ <span class =" fas fa-star" style =" color : {{ $color }};" ></span >
85
+ @endforeach
86
+ </div >
87
+ @endif
88
+ </div >
89
+ <p class =" text-muted mb-0" >{{ $item -> comment } }
90
+ </p >
91
+ </div >
92
+ </div >
93
+ @empty
94
+ <div class =" text-center text-light px-5" >
95
+ No Reviews available
96
+ </div >
97
+ @endforelse
98
+ </div >
99
+ <span id =" prev" class =" ti-arrow-circle-right custom-icon" ></span >
100
+ </div >
101
+ </section >
102
+
103
+ @push (' customCss' )
104
+ <style >
105
+ .scroll-wrapper {
106
+ display : flex ;
107
+ align-items : center ;
108
+ justify-content : center ;
109
+ gap : 10px ;
110
+ padding : 10px ;
111
+ }
112
+
113
+
114
+ @media (min - width : 970 px ) {
115
+ .scroll-wrapper {
116
+ padding : 1rem 5rem
117
+ }
118
+ }
119
+
120
+ @media (min - width : 640 px ) {
121
+ .scroll-wrapper {
122
+ gap : 1rem ;
123
+ padding : 2rem ;
124
+ }
125
+ }
126
+
127
+ .media-scroller {
128
+ display : flex ;
129
+ overflow-x : auto ;
130
+ gap : 1rem ;
131
+ overscroll-behavior-inline : contain ;
132
+ scroll-behavior : smooth ;
133
+ }
134
+
135
+ .media-elements {
136
+ display : flex ;
137
+ align-items : start ;
138
+ background : white ;
139
+ border-radius : 10px ;
140
+ gap : 1rem ;
141
+ padding : 1rem ;
142
+ max-width : 45ch ;
143
+ }
144
+
145
+ .media-elements .comment {
146
+ width : 100px ;
147
+ display : inline ;
148
+ margin : 0 ;
149
+ text-align : justify ;
150
+ }
151
+
152
+ .media-elements .image {
153
+ max-width : 70px ;
154
+ }
155
+
156
+ @media (min - width :600 px ) {
157
+ .media-elements .image {
158
+ max-width : 120px ;
159
+ }
160
+
161
+ .media-elements .comment {
162
+ width : 200px
163
+ }
164
+ }
165
+
166
+ #next ,
167
+ #prev {
168
+ background : none ;
169
+ border : none ;
170
+ padding : 0 ;
171
+ }
172
+
173
+ .custom-icon {
174
+ color : var (--bs-primary );
175
+ font-size : 28px ;
176
+ margin : 0 5px ;
177
+ cursor : pointer ;
178
+ }
179
+
180
+ .media-scroller ::-webkit-scrollbar {
181
+ appearance : none ;
182
+ display : none ;
183
+ }
184
+
185
+ .snaps-inline {
186
+ scroll-snap-type : inline mandatory ;
187
+ scroll-padding-inline : 5rem ;
188
+ }
189
+
190
+ .snaps-inline > * {
191
+ scroll-snap-align : start ;
192
+ }
193
+ </style >
194
+ @endpush
195
+
196
+ @push (' customJs' )
197
+ <script >
198
+ const container = document .querySelector (' .media-scroller' );
199
+ const next = document .getElementById (' next' )
200
+ const prev = document .getElementById (' prev' )
201
+ const scrollElementWidth = parseInt ($ (' .media-elements' ).css (' width' ).split (' px' )[0 ])
202
+ const scrollUnit = scrollElementWidth + 20 ;
203
+ container .addEventListener (' wheel' , e => {
204
+ e .preventDefault ();
205
+ container .scrollLeft += e .deltaY ;
206
+ })
207
+
208
+ next .addEventListener (' click' , () => {
209
+ container .scrollLeft -= scrollUnit;
210
+ })
211
+ prev .addEventListener (' click' , () => {
212
+ container .scrollLeft += scrollUnit;
213
+ })
214
+ </script >
215
+ @endpush
65
216
@endsection
66
217
67
218
@pushOnce (' customJs' )
0 commit comments