JSFiddle - React, Tailwind, and code Playground
Account transition #2
by Travis Almand
HTML
<div id="test" class="account-container">
<div class="account">click me</div>
</div>
<div class="account-container selected">
<div class="account"></div>
</div>
SCSS
.account-container {
align-items: center;
background: linear-gradient(45deg, #b4ddb4 0%,#83c783 17%,#52b152 33%,#008a00 67%,#005700 83%,#002400 100%);
border-radius: 10px;
box-shadow: 0 0 8px 0 rgba(0, 0, 0, 0.5);
display: flex;
height: 100px;
justify-content: center;
margin: 20px;
overflow: hidden;
width: 300px;
&.selected .account {
box-shadow: 0 0 0 0 white;
}
}
.account {
background-color: white;
box-shadow: 0 0 0 20px white;
border-radius: 10px;
height: calc(100% - 12px);
transition: 0.5s;
width: calc(100% - 12px);
}
JavaScript
document.querySelector('#test').addEventListener('click', function () {
this.classList.toggle('selected');
});