JSFiddle - React, Tailwind, and code Playground

by andy troy

HTML

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
    <link rel="stylesheet" href="styles.css">
    <title>Layout</title>
</head>
<body>
    <header class="header">
        <div class="header-left">
            <button class="btn-add-members">Add members</button>
        </div>
        <div class="header-right">
            <input type="text" class="search-bar" placeholder="Search by keyword">
            <div class="trial-info">Suite Professional trial ends in 14 days on February 20, 2023</div>
            <button class="btn-select-plan">Select Plan</button>
        </div>
    </header>
    <div class="container">
        <aside class="sidebar">
            <div class="logo">
                <!-- Add logo here -->
            </div>
            <nav class="nav-menu">
                <ul>
                    <li><a href="#"><i class="fas fa-home"></i><span class="tooltip">Home</span></a></li>
                    <li><a href="#"><i class="fas fa-tachometer-alt"></i><span class="tooltip">Dashboard</span></a></li>
                    <li><a href="#"><i class="fas fa-chart-line"></i><span class="tooltip">Analytics</span></a></li>
                    <li><a href="#"><i class="fas fa-cog"></i><span class="tooltip">Settings</span></a></li>
                    <li><a href="#"><i class="fas fa-sign-out-alt"></i><span class="tooltip">Logout</span></a></li>
                </ul>
            </nav>
        </aside>
        <main class="main-content">
            <!-- Main content goes here -->
        </main>
    </div>
</body>
</html>

CSS

body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    display: flex;
    height: 100vh;
    overflow: hidden;
    flex-direction: column;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    background-color: #f5f5f5;
    border-bottom: 1px solid #ddd;
    width: 100%;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

.header-left .btn-add-members {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 10px 20px;
    cursor: pointer;
}

.header-right {
    display: flex;
    align-items: center;
}

.search-bar {
    padding: 10px;
    margin-right: 20px;
    border: 1px solid #ccc;
    border-radius: 5px;
}

.trial-info {
    margin-right: 20px;
}

.btn-select-plan {
    background-color: #dc3545;
    color: white;
    border: none;
    padding: 10px 20px;
    cursor: pointer;
}

.container {
    display: flex;
    flex-direction: row;
    width: 100%;
    height: calc(100vh - 60px); /* Adjust the height considering the header height */
    margin-top: 60px;
}

.sidebar {
    width: 50px;
    background-color: #2b2b2b;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 20px;
    height: 100%;
    position: fixed;
    left: 0;
    top: 60px; /* Align below the header */
    bottom: 0;
    overflow: visible;
    z-index: 900;
}

.logo {
    margin-bottom: 20px;
}

.nav-menu ul {
    list-style-type: none;
    padding: 0;
    margin: 0;
    width: 100%;
}

.nav-menu ul li {
    margin-bottom: 20px;
    width: 100%;
    position: relative;
}

.nav-menu ul li a {
    color: white;
    text-decoration: none;
    font-size: 24px;
    display: flex;
    align-items: center;
    padding: 10px;
    justify-content: center;
    position: relative;
}

.nav-menu ul li a .tooltip {
    display: none;
    position: absolute;
    left: 55px;
    top: 50%;
    transform: translateY(-50%);
   ...