kokjan/frontend/views/site/_product.php

97 lines
2.3 KiB
PHP
Executable File

<?php
use yii\helpers\Html;
use yii\helpers\StringHelper;
$img = Yii::$app->abt->getFirstImage($model->description);
if (empty($img)) {
$img = Yii::getAlias('@web') . '/img/no-image.png';
}
?>
<style>
.otop-card-item {
background: #fff;
border-radius: 20px;
overflow: hidden;
border: 1px solid #FFDBBB;
transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
height: 100%;
display: flex;
flex-direction: column;
margin-bottom: 20px;
}
.otop-card-item:hover {
transform: translateY(-8px);
box-shadow: 0 12px 30px rgba(255, 192, 104, 0.2);
border-color: #FFC068;
}
.otop-img-box {
position: relative;
height: 180px;
overflow: hidden;
}
.otop-img-box img {
width: 100%;
height: 100%;
object-fit: cover;
transition: transform 0.5s ease;
}
.otop-card-item:hover .otop-img-box img {
transform: scale(1.1);
}
.otop-content {
padding: 20px;
flex-grow: 1;
display: flex;
flex-direction: column;
text-align: center;
}
.otop-title {
font-size: 16px;
font-weight: 800;
color: #2c1810;
margin-bottom: 10px;
line-height: 1.4;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
text-decoration: none !important;
}
.otop-title:hover {
color: #8e1d1d;
}
.otop-cat {
font-size: 12px;
color: #ff8f00;
font-weight: 700;
text-transform: uppercase;
margin-top: auto;
}
</style>
<div class="col-lg-4 col-md-6 mb-4">
<div class="otop-card-item wow zoomIn">
<div class="otop-img-box">
<?= Html::img($img, ['alt' => $model->name]) ?>
</div>
<div class="otop-content">
<?= Html::a(StringHelper::truncate($model->name, 60), ['/post/view', 'id' => $model->id, 'slug' => Yii::$app->abt->simpleSlug($model->name)], [
'class' => 'otop-title',
'title' => $model->name
]) ?>
<div class="otop-cat">
<i class="fa fa-tag mr-1"></i> <?= $model->cmsCategory->name ?>
</div>
</div>
</div>
</div>