client/app/styles/window.less

Summary

Maintainability
Test Coverage
@window-bg-color: white;
@window-toolbar-bg-color: whitesmoke;

@window-brand-color-group: #1D8BD1;
@window-brand-color-1on1: green;

.window {
    position: absolute;
    z-index: 0;
    padding: @grid-margin @grid-margin*1.2 @grid-margin @grid-margin*1.2;
    height: 100%;

    // Initial value, overwritten by velocity animation
    visibility: hidden;

    &.irc-server-window {
        .window-title {
            background-color: rgb(32, 147, 185);
        }
    }

    &.private-1on1 {
        .window-title {
            background-color: @window-brand-color-1on1;
        }

        .window-content {
            background-color: #f7fff7;
        }
    }

    &.group {
        .window-title {
            background-color: @window-brand-color-group;
        }
    }

    &.expanded {
        z-index: 10;
    }

    &.velocity-animating {
        z-index: 5;
    }

    &.moving {
        opacity: 0.3;
    }
}

.window-inner {
    font-size: 15px;
    color: #333333;
    height: 100%;
    box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);

    .window-content {
        background-color: @window-bg-color;
    }

    .window-title {
        padding: 4px 8px;
        color: whitesmoke;
    }

    .window-title-buttons {
        user-select: none;
    }

    .window-title-button {
        cursor: pointer;
        opacity: 0.4;
        margin-left: 2px;
    }

    .window-title-button.fa-arrows {
        cursor: move;
    }

    .window-title-button:hover {
        opacity: 1;
    }

    .window-caption {
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
        padding-right: 8px;
    }

    .window-messages {
        color: #333333;
        padding: 7px;
        overflow-y: scroll;
        overflow-x: hidden;
        line-height: 138%;
        font-weight: 400;
        position: relative; // Required for lazy image loading algorithm

        .emoji {
            height: 18px;
            position: relative;
            top: -1px;
        }

        img[data-src] {
            width: 48px;
            height: 48px;
        }

        .message-list {
            overflow-wrap: break-word;
        }
    }

    .line {
        display: flex;
        flex-direction: row;
    }

    .timestamp {
        color: #26547D;
        width: 42px;
        flex-shrink: 0;
    }

    .body {
        display: inline;
        flex: 1;
        min-width: 50%; // http://stackoverflow.com/a/36150764/2117215

        pre code {
            font-size: 12px;
        }
    }

    .msg-prefix {
        color: #333333;
        background-color: #eeeeee;
        padding: 0px 4px;
        border-radius: 3px;
        border: 1px solid #aa8888;
    }

    .nick {
        font-weight: bold;
        color: #104d73;
        padding-right: 4px;
        &:after {
            content: ":";
        }
    }

    .line:hover .edit-message-button {
        display: inline-block;
    }

    .edit-message-button {
        position: absolute;
        display: none;
        color: #777;
        text-align: center;
        padding: 1px 0px;
        width: 20px;
        background-color: whitesmoke;
        border: 1px solid #ddd;
        border-radius: 6px;

        &:hover {
            cursor: pointer;
        }
    }

    .nick + pre { // Special case where pre starts the message
        margin-top: 10px;
    }

    .nick-mention {
        background-color: lighten(#FCF399, 10%);
        border: 1px solid darken(#FCF399, 25%);
        padding: 0px 3px;
        border-radius: 2px;
    }

    .nick-mention::first-letter {
        visibility: none;
    }

    .nick-mention:hover {
        color: rgb(46, 124, 46);
        cursor: pointer;
    }

    .line {
        a, a:active, a:hover {
            color: #e12323;
        }
    }

    .line.banner {
        .nick {
            display: none;
        }

        .body {
            font-family: Courier New, monospace;
            text-overflow: ellipsis;
            font-size: 11px;
        }
    }

    .line.day-divider {
        .nick, .timestamp {
            display: none;
        }

        .body {
            color: #686060;
            font-size: 11px;
            font-weight: bold;
            text-align: center;
            white-space: nowrap;
            margin: 5px 0px;
            text-transform: uppercase;
            background-color: whitesmoke;
            pointer: default;
        }
    }

    .line.info {
        .nick {
            display: none;
        }

        .body {
            color: #a52a2a;
        }
    }

    .line.server {
        .nick {
            display: none;
        }

        .body {
            color: rgb(52, 85, 151)
        }
    }

    .line.mymsg {
        color: #0C7BC6;

        textarea {
            resize: none;
            width: 100%;
            color: black;
            border: 1px solid #999;
        }
    }

    .line.mention {
        background-color: lighten(#FCF399, 10%);
    }

    .line.service {
        .nick, .timestamp {
            display: none;
        }

        background-color: #fafafa;
        padding: 4px 10px;
        margin: 5px 5px 5px 42px;
        overflow-x: hidden;
        font-size: 12px;
        color: #655;
        width: 70%;
        border: 1px solid #eee;
    }

    .line.error {
        .nick {
            display: none;
        }

        .body {
            color: red;
        }
    }

    .line.join {
        .nick {
            display: none;
        }

        .body {
            color: green;
        }
    }

    .line.part, .line.quit, .line.kick {
        .nick {
            display: none;
        }

        .body {
            color: red;
        }
    }

    .line.action {
        .nick:after {
            content: " * ";
        }

        .body {
            color: green;
        }
    }

    .msg-edited-label {
        font-size: 10px;
        padding-left: 5px;
        cursor: default;
    }

    .msg-deleted-label {
        background-color: #F3F1F1;
        color: #7E7777;
        font-size: 9px;
        padding: 2px 5px;
        cursor: default;
        user-select: none;
        text-transform: uppercase;
    }

    ul.user-media {
        margin: 0px;
        padding: 0px;

        li {
            display: inline;
            list-style: none;
        }

        li img {
            max-height: 150px;
            max-width: 100%;
            width: auto;
            margin: 8px 8px 8px 0px;
        }

        .user-img-container {
            position: relative;
            display: inline-block;
        }

        .user-img-container:hover .user-img-close {
            display: block;
        }

        .user-img-container .user-img-close:hover {
            color: #df691a;
            opacity: 1;
        }

        .user-img-close {
            position: absolute;
            top: 11px;
            right: 11px;
            cursor: pointer;
            opacity: 0.5;
            color: #aaaaaa;
            display: none;
            z-index: 10;
        }
    }

    .user-img-restore {
        cursor: pointer;
        padding-left: 4px;
    }

    iframe.youtube-preview {
        height: 178px;
        padding: 9px 20px 9px 0px;
        vertical-align: middle;
    }

    .window-memers-list {
        width: 32px;
    }

    .window-members-list.window-members-wide {
        width: 100px;
    }

    .window-members {
        width: 100%;
        padding-top: 3px;
        position: relative;

        .member-row {
            height: 25px;
            cursor: default;
            padding: 1px 5px;
            user-select: none;
        }

        & > *:hover {
            background-color: #eee;
        }

        .window-operator {
            font-weight: bold
        }

        .window-voice::before {
            content: "+";
        }

        .gravatar {
            height: 23px;
            width: 23px;
            margin: 1px 5px 1px 0px;
            border: 1px solid rgb(209, 209, 209);
            float: left;
        }

        .member-name {
            padding-top: 3px;
            overflow-x: hidden;
            white-space: nowrap;
        }
    }

    .window-members-resize {
        height: 25px;
        text-align: right;
        padding-right: 9px;
        margin-bottom: 8px;
        color: #aaa;
        font-size: 25px;
        cursor: pointer;
    }

    .window-members-resize:hover {
        color: #1d8bd1;
    }

    .window-toolbar {
        border-top: 1px solid #ddd;
        background-color: whitesmoke;
        height: 32px;

        .btn {
            background-color: whitesmoke;
            color: #777777;
            padding: 3px 15px;
        }

        .dropdown-toggle {
            width: 50px;
        }

        .form-control {
            background-color: white;
            box-shadow: none;
            padding: 0px 10px;
        }
    }

    .window-start-label {
        color: #DF691A;
        padding: 3px 0px;
    }

    .window-upper-label {
        text-align: center;
        color: black;
        background-color: #ddd;
        padding: 5px;
    }

    .window-fetch-more {
        color: blue;
        text-decoration: underline;
        cursor: pointer;
    }

    .window-new-messages {
        position: absolute;
        white-space: nowrap;
        left: 0px;
        bottom: 40px;
        padding: 5px 10px 5px 5px;
        color: white;
        background-color: @navbar-default-bg;
        opacity: 0.93;
        z-index: 100;
        cursor: pointer;
    }

    .window-buttons {
        width: 100px;
    }

    .window-add-text-container {
        position: relative;

        textarea:focus {
            background-color: rgb(247, 243, 200);
            color: blue;
        }

        textarea:focus::placeholder {
            color:transparent;
        }

        textarea {
            position: absolute;
            height: 100%;
            bottom: 0px;
            left: 0px;
            right: 0px;
            resize: none;
            border: 0px;
            line-height: 28px;
        }
    }

    .js-upload {
        display: none;
    }

    .btn-file {
        position: relative;
        overflow: hidden;
    }

    .btn-file input[type=file] {
        position: absolute;
        top: 0;
        right: 0;
        width: 100%;
        height: 100%;
        opacity: 0;
        outline: none;
        cursor: inherit;
        display: block;
    }

    .connection-error {
        position: absolute;
        padding: 2px 7px;
        background-color: red;
        color: white;
        top: -27px;
        font-size: 12px;

        .fa {
            margin-right: 4px;
        }
    }
}