Skip to content

Instantly share code, notes, and snippets.

@ngocjohn
Created April 28, 2024 17:10
Show Gist options
  • Save ngocjohn/eee0fefd1a34ce754d1a7db0e27a65fc to your computer and use it in GitHub Desktop.
Save ngocjohn/eee0fefd1a34ce754d1a7db0e27a65fc to your computer and use it in GitHub Desktop.
DailyUI #025 - TV App
<!--
Follow me on
Dribbble: https://dribbble.com/supahfunk
Twitter: https://twitter.com/supahfunk
Codepen: https://codepen.io/supah/
-->
<div class="app">
<header>
<h1>Daily<strong>UI</strong></h1>
<nav></nav>
<div class="search"><svg><use xlink:href="#ico-search"></use></svg></div>
</header>
<h2>Most Popular Movies</h2>
<section class="movies">
<div class="movie">
<img src="https://github.com/supahfunk/supah-codepen/blob/master/movie-room.jpg?raw=true" alt="" class="poster" />
<div class="title">Room</div>
<div class="info">
<span class="length">117 min</span>
<span class="year">2015</span>
</div>
<div class="desc">
Jack is a young boy of 5 years old who has lived all his life in one room. He believes everything within it are the only real things in the world. But what will happen when his Ma suddenly tells him that there are other things outside of Room?
</div>
</div>
<div class="movie">
<img src="https://github.com/supahfunk/supah-codepen/blob/master/movie-whiplash.jpg?raw=true" alt="" class="poster" />
<div class="title">Whiplash</div>
<div class="info">
<span class="length">167 min</span>
<span class="year">2015</span>
</div>
<div class="desc">
Under the direction of a ruthless instructor, a talented young drummer begins to pursue perfection at any cost, even his humanity.
</div>
</div>
<div class="movie">
<img src="https://github.com/supahfunk/supah-codepen/blob/master/movie-madmax.jpg?raw=true" alt="" class="poster" />
<div class="title">Mad Max</div>
<div class="info">
<span class="length">120 min</span>
<span class="year">2015</span>
</div>
<div class="desc">
An apocalyptic story set in the furthest reaches of our planet, in a stark desert landscape where humanity is broken, and most everyone is crazed fighting for the necessities of life. Within this world exist two rebels on the run who just might be able to restore order. There's Max, a man of action and a man of few words, who seeks peace of mind following the loss of his wife and child in the aftermath of the chaos.
</div>
</div>
<div class="movie">
<img src="https://github.com/supahfunk/supah-codepen/blob/master/movie-therevenant.jpg?raw=true" alt="" class="poster" />
<div class="title">The Revenant</div>
<div class="info">
<span class="length">156 min</span>
<span class="year">2015</span>
</div>
<div class="desc">
In the 1820s, a frontiersman, Hugh Glass, sets out on a path of vengeance against those who left him for dead after a bear mauling.
</div>
</div>
</section>
<div class="detail">
<svg class="close">
<use xlink:href="#close"></use>
</svg>
<div class="movie">
<img src="https://github.com/supahfunk/supah-codepen/blob/master/movie-room.jpg?raw=true" alt="" class="poster" />
<div class="title">Room</div>
<div class="info">
<span class="length">117 min</span>
<span class="year">2015</span>
</div>
<div class="desc">
Jack is a young boy of 5 years old who has lived all his life in one room. He believes everything within it are the only real things in the world. But what will happen when his Ma suddenly tells him that there are other things outside of Room?
</div>
<button class="play">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Capa_1" x="0px" y="0px" viewBox="0 0 232.153 232.153" style="enable-background:new 0 0 232.153 232.153;" xml:space="preserve" width="10px" height="10px">
<g id="Play">
<path style="fill-rule:evenodd;clip-rule:evenodd;" d="M203.791,99.628L49.307,2.294c-4.567-2.719-10.238-2.266-14.521-2.266 c-17.132,0-17.056,13.227-17.056,16.578v198.94c0,2.833-0.075,16.579,17.056,16.579c4.283,0,9.955,0.451,14.521-2.267 l154.483-97.333c12.68-7.545,10.489-16.449,10.489-16.449S216.471,107.172,203.791,99.628z" fill="#FFFFFF"/>
</g>
</svg> play movie
</button>
</div>
</div>
</div>
<!-- Icons -->
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="display:none;">
<symbol id="close" viewBox="0 0 212.982 212.982">
<g>
<path style="fill-rule:evenodd;clip-rule:evenodd;" d="M131.804,106.491l75.936-75.936c6.99-6.99,6.99-18.323,0-25.312 c-6.99-6.99-18.322-6.99-25.312,0l-75.937,75.937L30.554,5.242c-6.99-6.99-18.322-6.99-25.312,0c-6.989,6.99-6.989,18.323,0,25.312 l75.937,75.936L5.242,182.427c-6.989,6.99-6.989,18.323,0,25.312c6.99,6.99,18.322,6.99,25.312,0l75.937-75.937l75.937,75.937 c6.989,6.99,18.322,6.99,25.312,0c6.99-6.99,6.99-18.322,0-25.312L131.804,106.491z" fill="#525661"/>
</g>
</symbol>
<symbol id="ico-search">
<path fill-rule="evenodd" clip-rule="evenodd" fill="#363a47" d="M14.769,14.769c-0.342,0.342-0.896,0.342-1.237,0l-3.756-3.756
c-2.399,1.793-5.801,1.623-7.981-0.557c-2.392-2.392-2.392-6.271,0-8.663s6.271-2.392,8.662,0c2.18,2.181,2.35,5.583,0.557,7.981
l3.756,3.756C15.11,13.873,15.11,14.427,14.769,14.769z M9.219,3.032c-1.709-1.709-4.479-1.709-6.188,0
c-1.708,1.708-1.708,4.479,0,6.188c1.709,1.708,4.479,1.708,6.188,0C10.927,7.51,10.927,4.74,9.219,3.032z"/>
</symbol>
</svg>
<a class="the-most" target="_blank" href="https://codepen.io/2016/popular/pens/4/">
<img src="https://raw.githubusercontent.com/supahfunk/supah-codepen/master/themost-2016.png">
</a>
var $play = $('.play'),
$detail = $('.detail'),
$movie = $('.movie', $detail),
$close = $('.close');
$('.movies .movie').click(function(){
$movie.html($(this).html());
$play.appendTo($movie);
$poster = $('.poster', this).addClass('active');
$('.poster', $detail).css({
top: $poster.position().top,
left: $poster.position().left,
width: $poster.width(),
height: $poster.height()
}).data({
top: $poster.position().top,
left: $poster.position().left,
width: $poster.width(),
height: $poster.height()
})
$detail.show();
$('.poster', $detail).delay(10).queue(function(next) {
$detail.addClass('ready');
next();
}).delay(100).queue(function(next){
$(this).css({
top: '-10%',
left: '-6%',
width: 266,
height: 400
});
next();
})
})
/*--------------------
Close
--------------------*/
function close(){
console.log('asd');
$p = $('.detail .poster');
console.log($p)
$p.css({
top: $p.data('top'),
left: $p.data('left'),
width: $p.data('width'),
height: $p.data('height'),
})
$detail.removeClass('ready').delay(500).queue(function(next){
$(this).hide();
$poster.removeClass('active');
next();
});
}
$close.click(close);
$('body').click(function(e){
$p = $(e.target).parents();
if ($p.is('.app')){
return false;
} else {
close();
}
})
/*--------------------
CodePen Thumbnail
--------------------*/
setTimeout(function(){
$('.movie:eq(0)').click();
}, 300);
setTimeout(function(){
close();
},1700);
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js"></script>
/*--------------------
Body
--------------------*/
*,
*::before,
*::after {
box-sizing: border-box;
}
body {
height: 100vh;
margin: 0;
background: radial-gradient(ellipse farthest-corner at center top, #ffee75, #ff8930);
color: #8b9095;
font-size: 14px;
font-family: 'Roboto', sans-serif;
}
@mixin center {
position: relative;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
/*--------------------
App
--------------------*/
.app {
@include center;
width: 640px;
height: 390px;
background: #fff;
border-radius: 15px;
box-shadow: 0 5px 30px rgba(0, 0, 0, .2);
h2 {
color: #525661;
font-size: 17px;
box-shadow: inset 0 1px 0px rgba(0, 0, 0, 0.1);
padding: 20px 28px 0;
margin: -6px 0 0 0;
}
}
/*--------------------
Header
--------------------*/
header {
padding: 30px;
position: relative;
height: 70px;
h1 {
@include center;
font-size: 20px;
text-transform: uppercase;
text-align: center;
color: #1c222b;
strong {
background: #F16018;
color: #fff;
display: inline-block;
border-radius: 30px;
padding: 6px;
font-size: 83%;
line-height: 1;
position: relative;
top: -1px;
left: 2px;
}
}
nav {
cursor: pointer;
width: 18px;
height: 18px;
position: absolute;
top: 28px;
left: 28px;
&::before {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 2px;
background: #363a47;
border-radius: 2px;
box-shadow: 0 5px 0 #363a47, 0 10px 0 #363a47;
}
}
.search {
position: absolute;
top: 26px;
right: 18px;
cursor: pointer;
svg {
width: 20px;
height: 20px;
}
}
}
/*--------------------
Movies
--------------------*/
.movies {
display: flex;
padding: 8px 18px;
.movie {
padding: 10px;
cursor: pointer;
.poster {
width: 100%;
margin-bottom: 6px;
border-radius: 4px;
&.active {
opacity: 0;
}
}
.title {
//text-transform: uppercase;
color: #525661;
margin-bottom: 4px;
font-size: 16px;
}
.info {
font-size: 11px;
opacity: .8;
}
.desc {
display: none;
}
}
}
/*--------------------
Detail
--------------------*/
.detail {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 10;
padding: 37px 30px 30px 255px;
display: none;
&::before {
content: '';
background: #fff;
position: absolute;
z-index: -1;
top: 0;
left: 0;
width: 100%;
height: 100%;
border-radius: 15px;
opacity: 0;
transition: all .4s cubic-bezier(.67,.13,.1,.81);
}
.close {
position: absolute;
top: 21px;
right: 22px;
width: 12px;
height: 12px;
cursor: pointer;
border: 6px solid #FFF;
box-sizing: content-box;
z-index: 10;
}
.poster {
position: absolute;
z-index: 2;
top: -10%;
left: -6%;
height: 100%;
border-radius: 5px;
box-shadow: 0 5px 30px rgba(0, 0, 0, .2);
//opacity: 0;
transition: all .5s cubic-bezier(.67,.13,.1,.81);
}
.title,
.info,
.desc,
.play,
.close {
transform: translateX(-50px);
opacity: 0;
transition: all .4s cubic-bezier(.67,.13,.1,.81);
}
.close {
transform: translateX(10px);;
}
.title {
font-size: 35px;
font-weight: 300;
color: #525661;
margin-bottom: 5px;
}
.info {
font-size: 11px;
opacity: 0;
margin-left: 2px;
}
.desc {
margin-top: 30px;
font-size: 14px;
line-height: 1.6;
}
.play {
background: linear-gradient(90deg, #E4761F, #FF8B32);
border: none;
border-radius: 20px;
color: #fff;
font-size: 12px;
line-height: 1.5;
padding: 8px 17px;
margin: 30px 0 0 -2px;
text-transform: uppercase;
z-index: 10;
outline: none !important;
cursor: pointer;
opacity: 0;
svg {
vertical-align: middle;
position: relative;
top: -2px;
margin-right: 3px;
}
}
}
.detail.ready {
&::before {
opacity: 1;
}
.info {
opacity: .8;
}
.poster {
opacity: 1;
transition-duration: .5s;
}
.title,
.info,
.desc,
.play,
.close {
transform: translateX(0);
opacity: 1;
transition-delay: 0s;
transition-duration: .5s;
}
.title {
transition-delay: .2s;
}
.info {
transition-delay: .3s;
}
.desc {
transition-delay: .4s;
}
.play {
transition-delay: .5s;
}
}
.the-most {
position: fixed;
z-index: 1;
bottom: 0;
left: 0;
width: 50vw;
max-width: 200px;
padding: 10px;
img {
max-width: 100%;
}
}
<link href="https://fonts.googleapis.com/css?family=Roboto:100,300,400" rel="stylesheet" />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment