JSFiddle - React, Tailwind, and code Playground

by kapilgopinath

HTML

<div id="msgStatusTitle">Unread</div>
<div id="accordionsContainer">
    
        <div class="screenWrapper" data-messagetype="Unread" style="display: none;">
            <div class="badge unread">5</div>
            <div class="rotate">Unread</div>
        </div>
        <div class="screenWrapper" data-messagetype="Actionable">
            <div class="badge actionable">1</div>
            <div class="rotate">Actionable</div>
        </div>
        <div class="screenWrapper" data-messagetype="All">
            <div class="badge messages-all">5</div>
            <div class="rotate">All Messages</div>
        </div>
        <div class="screenWrapper" data-messagetype="Archive">
            <div class="badge archive-blank">&nbsp;</div>
            <div class="rotate">Archive</div>
        </div>
    
</div>

CSS

#accordionsContainer {
    width: 100%;
    height: 638px;
    min-height: 100px;
}
.rotate {
    padding-top: 2px;
    padding-left: 4px;
    /*overflow: hidden;*/
    position: relative;
    clear: both;
    -moz-transform: rotate(270deg);
    -moz-rotation-point: 0 0;
    -webkit-transform: rotate(270deg);
    -webkit-rotation-point: 0 0;
    -o-transform: rotate(270deg);
    -ms-transform: rotate(270deg);
    height: auto;
    width: auto;
    cursor: pointer;
    color: #997d71;
    font-weight: bold;
    white-space: nowrap;
}
.screenWrapper {
    float: left;
    width: 50px;
    height: 100%;
    border-top: #ebeae6 solid 0.1em;
    border-bottom: #ebeae6 solid 0.1em;
    border-right: #ebeae6 solid 0.1em;
    background-color: #fcfcfc;
    position: relative;
    margin-top: 100px;
}
.screenWrapper:after {
    display: block;
    content:" ";
    width: 18px;
    height: 8px;
    position: absolute;
    right: -19px;
    bottom: 0px;
}

.screenWrapper:nth-child(1){
    display: block;
    height: 616px;
    margin: 10px 0;
}

.screenWrapper:nth-child(2){
    display: block;
    height: 596px;
    margin: 20px 0;
}

.screenWrapper:nth-child(3){
    display: block;
    height: 576px;
    margin: 30px 0;
}

.screenWrapper:nth-child(4){
    display: block;
    height: 556px;
    margin: 40px 0;
}
.badge {
    height: 35px;
    position: relative;
    top: 3px;
    width: 100%;
    padding-top: 9px;
    text-align: center;
    margin-bottom: 100px;
    color: #fff;
}

JavaScript

var container = $('#accordionsContainer');

container.on('click', '.screenWrapper', function () {
    var $screen = $(this),
        $hiddenScreen = container.find('.screenWrapper:not(:visible)') ;
    if($hiddenScreen.length){
    $screen.hide('slow');
    container.append( $hiddenScreen.show() );
    // move hidden screen to first position
    container.prepend( $screen ); 
    }
    
});