Skip to content

Commit

Permalink
add responsive cards
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardavieira-dev committed Nov 29, 2024
1 parent afc0fb3 commit 201e430
Show file tree
Hide file tree
Showing 5 changed files with 334 additions and 84 deletions.
34 changes: 34 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@

new Swiper('.card-wrapper', {

loop: true,
spaceBetween: 30,

// If we need pagination
pagination: {
el: '.swiper-pagination',
clickable: true,
dynamicBullets: true
},

// Navigation arrows
navigation: {
nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev',
},

breakpoints:{
0:{
slidesPerView: 1
},
768:{
slidesPerView: 2
},
1124:{
slidesPerView: 4
},
}


});

183 changes: 182 additions & 1 deletion assets/css/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -116,4 +116,185 @@ a{
.plataforma{
width:40px;
border-radius: 5px;
}
}


/* cards carrossel */
.card-wrapper{
display: flex;
max-width: 1200px;
margin: 0 0px 30px 00px;
padding: 10px 20px;
overflow: hidden;
justify-content: center;
align-items: center;
}

.card-list .card-item{
list-style: none;
}

.card-list .card-item .card-link {
user-select: none;
display: block;
background: #f9edff;
/* padding: 15px 18px; */
border-radius: 10px;
text-decoration: none;
border: 2px solid transparent;
box-shadow: 0 8px 12px rgba(136, 45, 164, 0.244);
}
.card-title{
padding: 0 20px;

}
.card-text{
padding: 0 20px;
margin: 20px 0;
color: #392a3c;
font-size: 1.1rem;
padding-bottom: 15px;
}
.card-list .card-item .card-link:hover{
border-color: #b43aec;
transition: all .7s;
}
.card-list .card-link .card-image{
width: 100%;
aspect-ratio:9/9;
object-fit: cover;
border-radius: 10px 10px 0px 0px;
}
.card-list .card-link{
color: #b43aec;
/* padding: 8px 26px; */
font-size: 0.95rem;
font-weight: 500;
margin: 16px 0 18px;
background-color: #f0d4fd;
width: fit-content;
border-radius: 50px;
}

.card-list .card-link .card-title{
font-size: 1.5rem;
color: #000;
font-weight: 600;
margin: 20px 0;
}

.card-list .card-link .card-button{
height: 35px;
width: 35px;
border-radius: 50%;
color: #b43aec;
margin: 30px 0 5px;
background: none;
cursor: pointer;
border: 2px solid #b43aec;
transform: rotate(-45deg);
transition: .4s ease;
}

.card-list .card-link:hover .card-button{
color: #fff;
background: #b43aec;
}
.card-wrapper .swiper-pagination-bullet{
height: 13px;
width: 13px;
opacity: 0.5;
background: #b43aec;

}
.card-wrapper .swiper-pagination-bullet-active{
opacity: 1;
}

.card-wrapper .swipper-slider-button{
color: #b43aec;

}


/* slider index */
.swiper-caption {
position: absolute;
bottom: 20px;
left: 10%;
right: 10%;
background-color: rgba(0, 0, 0, 0.2);
color: #fff;
padding: 10px;
border-radius: 8px;
text-align: center;
}



/* Estilo dos botões de navegação */
.swiper-button-next,
.swiper-button-prev {
color: #b43aec !important;
transition: color 0.3s ease;
}

/* Hover para os botões */
.swiper-button-next:hover, .swiper-button-prev:hover {
color: #8a2ab9;
}

/* Paginação - Padrão */
.swiper-pagination-bullet {
background-color: #b43aec !important;
opacity: 0.5;
transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Paginação - Ponto ativo */
.swiper-pagination-bullet-active {
background-color: #b43aec !important;
opacity: 1;
transform: scale(1.2);
}
/* Legenda */
.swiper-caption {
position: absolute;
bottom: 20px;
left: 10%;
right: 10%;
background-color: rgba(0, 0, 0, 0.4);
color: #fff;
padding: 10px;
border-radius: 8px;
text-align: center;
font-size: 19px;
}

/* Imagem ajustada */
.swiper-slide img {
max-height: 500px;
object-fit: cover;
border-radius: 5px;
}

/* Responsividade: ocultar legendas em telas pequenas */
@media (max-width: 768px) {
.swiper-caption {
display: none;
}
}


@media only screen and (min-width: 600px){
.card-wrapper{
display: flex;
max-width: 1200px;
margin: 0 50px 30px 50px;
padding: 10px 20px;
overflow: hidden;
justify-content: center;
align-items: center;
}

}
64 changes: 60 additions & 4 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ <h5 class="explorar"><a class="nav-link" href="explorer.html">Explorar</a></h5>


<!-- /header -->

<!--
<main class="main mx-auto py-4">
<div id="carouselExampleIndicators" class="carousel slide">
<div class="carousel-indicators">
Expand Down Expand Up @@ -90,13 +90,53 @@ <h5>Sorriso Real</h5>
<span class="visually-hidden">Próximo</span>
</button>
</div>
</main> -->

<main class="main mx-auto py-4">
<!-- Swiper -->
<div class="swiper mySwiper">
<div class="swiper-wrapper">
<!-- Slide 1 -->
<div class="swiper-slide">
<a href="explorer.html">
<img src="./assets/images/series/thechosen.jpg" class="d-block w-100" alt="The Chosen">
</a>
<div class="swiper-caption">
<h5>The Chosen</h5>
<p>Uma série sobre Jesus, baseada na bíblia. Jesus chama os apóstolos para segui-lo e pregar o evangelho junto a ele.</p>
</div>
</div>
<!-- Slide 2 -->
<div class="swiper-slide">
<a href="explorer.html">
<img src="./assets/images/series/De_Volta_aos_15-cover.jpg" class="d-block w-100" alt="De Volta aos 15">
</a>
<div class="swiper-caption">
<h5>De Volta aos 15</h5>
<p>Uma série brasileira de drama adolescente, baseada no romance de Bruna Vieira, sobre Anita, que volta aos 15 anos.</p>
</div>
</div>
<!-- Slide 3 -->
<div class="swiper-slide">
<a href="explorer.html">
<img src="./assets/images/series/sorriso.jpg" class="d-block w-100" alt="Sorriso Real">
</a>
<div class="swiper-caption">
<h5>Sorriso Real</h5>
<p>Um K-drama sobre um homem rico que odeia sorrisos e sua aproximação inesperada de um romance com sua funcionária.</p>
</div>
</div>
</div>
<!-- Navigation buttons -->
<div class="swipper-slider-button swiper-button-next"></div>
<div class="swipper-slider-button swiper-button-prev"></div>
<!-- Pagination -->
<div class="swiper-pagination"></div>
</div>
</main>






<div class="content">
<h2 class="t-conteudo">Mais assistidas</h2>
<div class="row text-center">
Expand Down Expand Up @@ -287,5 +327,21 @@ <h5 class="card-title">Wandinha</h5>
<p>Eduarda Vieira | 2024</p>
</footer>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
<link rel="stylesheet" href="https://unpkg.com/swiper/swiper-bundle.min.css">

<script src="https://unpkg.com/swiper/swiper-bundle.min.js"></script>
<script>
const swiper = new Swiper('.mySwiper', {
loop: true,
navigation: {
nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev',
},
pagination: {
el: '.swiper-pagination',
clickable: true,
},
});
</script>
</body>
</html>
Empty file added index.js
Empty file.
Loading

0 comments on commit 201e430

Please sign in to comment.