superdesk/superdesk-client-core

View on GitHub
scripts/apps/authoring/styles/themes.scss

Summary

Maintainability
Test Coverage
// Styling for authoring screen editor
// ----------------------------------------------------------------------------------------
@import '~mixins.scss';
@import '~variables.scss';

$main-article-padding : 3.2rem 4rem $bottom-view-padding 4rem;

// Themes color config
//-----------------------------------------------------------

// dark
$dark-theme-bg:             hsl(0, 0%, 13%);
$dark-theme-text:           hsl(188, 30%, 74%);

//natural
$natural-theme-bg:          hsl(51, 57%, 85%);
$natural-theme-text:        hsl(0, 0%, 20%);



//dark-khaki
$dark-khaki-theme-bg:       hsl(70, 25%, 50%);
$dark-khaki-theme-text:     hsl(71, 25%, 13%);

//dark-turquise
$dark-turquoise-theme-bg:   hsl(181, 100%, 41%);
$dark-turquoise-theme-text: hsl(213, 49%, 14%);

//dark-blue
$dark-blue-theme-bg:        hsl(212, 89%, 22%);
$dark-blue-theme-text:      hsl(0, 0%, 100%);

//pale-yellow
$pale-yellow-theme-bg:      hsl(62, 91%, 79%);
$pale-yellow-theme-text:    hsl(0, 0%, 20%);

//mono
$monoFontFamily: "Roboto Mono", Consolas, Courier, monospace;


@mixin dark-theme() {
    background: $dark-theme-bg;
    color: $dark-theme-text !important;
}

@mixin natural-theme() {
    background: $natural-theme-bg;
    color: $natural-theme-text !important;
}

@mixin dark-theme-mono() {
    background: $dark-theme-bg;
    color: $dark-theme-text !important;
}

@mixin dark-khaki-theme() {
    background: $dark-khaki-theme-bg;
    color: $dark-khaki-theme-text !important;
}

@mixin dark-turquoise-theme() {
    background: $dark-turquoise-theme-bg;
    color: $dark-turquoise-theme-text !important;
}

@mixin dark-blue-theme() {
    background: $dark-blue-theme-bg;
    color: $dark-blue-theme-text !important;
}

@mixin pale-yellow-theme() {
    background: $pale-yellow-theme-bg;
    color: $pale-yellow-theme-text !important;
}

body, html {
    height: 100%;
}

.modal-body {
    .main-article {
        border-width: 0;
        padding: 10px;
    }
}

.field-label--base {
    @include text-normal();
    background: rgba(0, 0, 0, 0.4);
    @include border-radius(2px);
    color: #fff;
    display: inline-block;
    padding: 2px 8px 1px;
    font-size: 11px;
    font-family: "Roboto", sans-serif;
    line-height: 16px;
    @include transition(all ease 0.2s);
    text-transform: uppercase;
    font-style: normal;
    letter-spacing: 0.1em;
}

.field-label--base--invalid {
    background: $errorText;
    color: white;
}

.authoring-sticky__theme-controls {
    display: flex;
    flex-direction: row;
    align-items: center;
    .icn-btn {
        margin-inline-start: 3px;
    }
    .proofread-toggle {
        &:hover {
            background-color: rgba(152, 152, 152, 0.3);
        }
        &.active {
            box-shadow: inset 0 2px 0 rgba(55, 55, 55, 0.1);
            background-color: var(--sd-colour-interactive--active);
            color: $white;
            opacity: 1;
            i {
                opacity: 1;
            }
        }
    }


    .theme-select {
        display: inline-block;

        .dropdown__toggle {
            position: relative;
            i {
                margin-block-end: 1px;
            }
            &:hover {
                background-color: rgba(152, 152, 152, 0.3);
            }
        }
        &.open {
            .dropdown__toggle {
                @include box-shadow(inset 0 2px 0 rgba(55, 55, 55, 0.1));
                background-color: rgba(152, 152, 152, 0.3);
            }
        }
        .dropdown__menu {
            min-width: 424px;
            padding: 10px;
            inset-inline-end: -9px;
            .theme-status {
                position: absolute;
                width: 8px;
                height: 8px;
                border-radius: 8px;
                margin-block-start: 4px;
                margin-inline-start: 0px;
                background-color: #ccc;
                &.active {
                    background-color: #107401;
                }
            }
            .dropdown__menu-label {
                padding-inline-start: 13px;
                margin-block-end: 6px;
            }
            > ul {
                float: inline-start;
                vertical-align: top;
                width: 50%;
                padding-inline-start: 9px;
                @include box-sizing(border-box);
                &.normal-theme-list {
                    padding-inline-end: 9px;
                    padding-inline-start: 0;
                    border-inline-end: 1px solid #e5e5e5;
                }
            }
            .btn-group {
                margin-block-end: 20px;
                display: flex;
                justify-content: space-between;
                .toggle-button {
                    width: 48%;
                }
            }
            .theme-btn {
                @include border-radius(2px);
                margin-block-end: 6px;
                border: 1px solid #e9e9e9;
                position: relative;
                padding-inline-end: 20px;
                padding-inline-start: 12px;
                text-overflow: ellipsis;
                overflow: hidden;
                min-width: auto !important;
                width: 100%;
                min-width: auto;
                i {
                    margin: 0;
                    position: absolute;
                    inset-block-start:10px;
                    inset-inline-end: 0px;
                    color: inherit !important;
                }
                &.dark-theme {
                    border: 0;
                    @include dark-theme();
                }
                &.dark-blue-theme {
                    border: 0;
                    @include dark-blue-theme();
                }
                &.dark-theme-mono {
                    border: 0;
                    @include dark-theme();
                    font-family: $monoFontFamily;
                }
                &.natural-theme {
                    border: 0;
                    @include natural-theme();
                }
                &.dark-khaki-theme {
                    border: 0;
                    @include dark-khaki-theme();
                }
                &.dark-turquoise-theme {
                    border: 0;
                    @include dark-turquoise-theme();
                }
                &:hover {
                    background-color: inherit !important;
                    color: inherit !important;
                }
            }
        }
    }
}

.main-article {
    width:auto;
    position:relative;
    z-index: 1;
    padding: $main-article-padding;
    margin:0 auto;
    min-height:100%;
    .field {
        max-width: 100%;
        margin-block-end: 20px;
        .full-preview {
            display: inline-block;
        }
        .dateline {
            display: flex;
            flex-direction: row;
            align-items: flex-end;

            input, select, option {
                color: var(--sd-editor-colour__txt);
                font-size: 14px;
                font-weight: 400 !important;
                padding: 0;
                -webkit-appearance: none;
                -moz-appearance: none;
            }
            select {
                width: 20%;
            }
            .dateline-city {
                display: flex;
                flex: 1 1 auto;
                font-size: 1.4rem;
                line-height: 2.7rem;
                padding-inline-end: 2rem;
                input {
                    padding-inline-start: $sd-base-increment * 1.5;
                }
                .term-editor {
                    flex: 1 1 auto;
                }
            }
            .dateline-date {
                flex: 0 1 20%;
                display: flex;
                flex-direction: row;
                align-items: flex-end;
                #datelineMonth {
                    flex: 1 1 auto;
                    width: auto;
                    margin-inline-end: 0.6rem;
                }
                #datelineDay {
                    text-align: center;
                    flex: 0 1 3.4rem;
                    width: auto;
                }
            }
        }
        .dropdown {
            display: block;
        }
    }

    //labels
    .field {
        .field__label {
            @extend .field-label--base;
            margin-bottom: 15px;
            opacity: 0.4;
        }
        &.active {
            .field__label {
                background: var(--sd-colour-interactive--active);
                transition: all ease 0.6s;
            }
        }
    }
    .main-article__fieldset {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        align-content: flex-start;
        max-width: 1000px;
        margin: 0 auto;
    }
    .sd-validate .sd-required {
        color: inherit;
        opacity: 0.75;
        letter-spacing: 0.04em;
        font-family: "Roboto", sans-serif;
    }
    .text-field__non-editable {
        font-size: 1.6rem;
        line-height: 150%;
        min-height: 2.7rem;
        padding: 2px 0 0 1px;
        word-break: break-all;
    }
    // inputs
    .text-editor, .field__select {
        border: 1px solid rgba(123, 123, 123, 0) !important;
        border-bottom-color: rgba(123, 123, 123, 0.30) !important;
        padding: 0;
        border-radius: 0;
        background-color: transparent;
        &:focus {
            outline:none;
        }
        h1, h2, h3, h4, h5, h6 {
            font-size: 16px;
            line-height: 18px;
            margin-block-end: 9px;
        }
    }
    .field__select {
        -moz-appearance: none;
        -webkit-appearance: none;
    }
    input {
        border-color: rgba(150, 150, 150, 0.4) !important;
        background: inherit;
        color: inherit;
    }
    .text-editor:hover, .headline:hover, .abstract:hover, .field__select:hover {
        border-bottom-color: rgba(123, 123, 123, 0.60) !important;
    }

    .text-editor, .headline, .abstract {
        &:not([disabled]) {
            cursor: text;
        }
    }

    .headline .public-DraftEditor-content {
        font-weight: 500;
        line-height: 1.2;
    }

    .abstract .public-DraftEditor-content {
        font-weight: 400;
    }

    .field__select:hover {
        -moz-appearance: menulist-button;
        -webkit-appearance: menulist-button;
    }
    .text-editor:focus, .headline:focus, .abstract:focus, input:focus, .field__select:focus {
        //.box-shadow(none) !important;
        border-width: 1px !important;
        border-color: rgba(94, 169, 200, 0.3) !important;
        border-bottom-color: rgba(94, 169, 200, 1) !important;
        box-shadow: 0 1px 0 rgba(94, 169, 200, 1) !important;
    }
    &.preview {
        .text-editor {
            border-color: #fff !important;
        }
    }
    // character and word counting
    .char-count {
        font-family: "Roboto", sans-serif;
        font-size: 11px;
        font-style: italic;
        color: inherit;
        margin-inline-start: 5px;
        float: inline-end;
        @include opacity(0);
        @include transition(all ease 0.2s);
        &.error {
            @include text-semibold();
            color: #D33C30;
            @include opacity(100);
        }
    }
    &:hover, &:focus {
        .char-count {
            @include opacity(40);
            &.error {
                @include opacity(100);
            }
        }
        .field label, .field__label {
            @include opacity(100);
        }
    }
    .field.limit-error {
        .char-count {
            @include opacity(100);
        }
        input, textarea {
            border-color: rgba(210, 60, 50, 0.15) !important;
        }
    }
    .field.limit-error input, .field.limit-error textarea {
        @include text-semibold();
        color: #D33C30 !important;
    }
    // images
    figure {
        width: 100%;
        display: table;
        table-layout: fixed;
        margin: 10px 0;
        &.item-association {
            margin: 0;
        }
        &.sd-list-item__thumbnail {
            width: 6.4rem;
            margin: auto 0.8rem;
            display: flex;
        }
    }
    figure img {
        display: block;
        max-width: 100%;
        margin: 0 auto;
    }
    figcaption {
        border: 1px solid rgba(150, 150, 150, 0.15);
        padding: 8px;
        min-height: 18px;
    }
    // text styles
    color: var(--sd-editor-colour__txt);
    .text-editor, .headline, .abstract {
        color: var(--sd-editor-colour__txt);
        padding-inline-start: 0;
        padding-inline-end: 0;
    }
    .keyword {
        text-transform: uppercase;
        font-weight: 500;
    }
    .byline {
        font-size: 16px;
        text-transform: none;
        padding-block-start: 2px;
        padding-block-end: 2px;
        padding-inline-start: $sd-base-increment * 1.5;
        background-color: transparent;
        line-height: 150%;
        .text-editor {
            min-height: 24px;
        }
        &::placeholder, &::-webkit-input-placeholder, &::-moz-placeholder {
            color: var(--sd-editor-colour__txt);
            opacity: 0.4;
        }
        &:focus {
            &::-webkit-input-placeholder { color:transparent; }
            &::-moz-placeholder { color:transparent; }
        }
    }
    .image-caption {
        font-size: 14px;
        text-transform: none;
        line-height: 140%;
        &::placeholder, &::-webkit-input-placeholder, &::-moz-placeholder {
            color: var(--sd-editor-colour__txt);
            opacity: 0.4;
        }
        &:focus {
            &::-webkit-input-placeholder { color:transparent; }
            &::-moz-placeholder { color:transparent; }
        }
    }
    #body_footer {
        .text-editor {
            min-height: 26px;
            padding: 0 !important;
            margin-block-end: 10px !important;
            font-size:16px !important;
            line-height: 1.5 !important;
            font-weight: 300;
        }
    }
    .headline p {
        line-height: 1.2 !important;
        font-weight: 500;
        .text-editor {
            min-height: 48px;
            padding: 6px 0;
        }
        .html-preview {
            font-size: 2.8rem;
        }
    }
    .body {
        clear: left;
        .html-preview {
            font-size: 1.6rem;
            font-weight: 300;
            line-height: 1.5;
            p {
                font-size: 1.6rem;
            }
        }
    }
}

.text-editor, .preview-editor {
    p {
        padding: 0;
        margin-block-end: 10px;
        line-height: 1.5;
        font-weight: 300;
    }
    p:last-of-type {
        margin-block-end: 0 !important;
    }
    h2 {font-size: 1.5em;}
    h3 {font-size: 1.25em;}
    &.clone {
        position: absolute;
        inset-block-start: 0;
        inset-inline-start: 0;
        inset-inline-end: 0;
        margin-block-start: 0;
        z-index: -1;
        opacity: 0.5;
        color: rgba(0, 0, 0, 0) !important;
        border-bottom-color: rgba(0, 0, 0, 0) !important;
        .sderror {
            font-size: inherit;
            line-height: inherit;
            font-weight: inherit;
        }
    }
    li {
        padding: 0;
        font-size: 16px;
        line-height: 150%;
        @include text-light();
    }
    ol, ul {
        padding-inline-start: 30px;
        margin: 10px 0;
    }
    ul {
        list-style-type: disc;
    }
    table {
        width: 100%;
        border-collapse: collapse;
        resize: both;
        table-layout: auto;
        border: 1px solid #dadada;
        margin: 16px 0;
        td, th {
            border: 1px solid #dadada;
            padding: 5px 8px;
            font-size: 14px;
            font-weight: 400;
            vertical-align: text-top;
        }
        th {
            font-weight: 500;
            text-align: start;
            background-color:rgba(195, 195, 195, 0.2);
        }
    }
    blockquote {
        font-size: 16px;
        line-height: 150%;
        margin: 20px 0;
        border-inline-start: 3px solid rgba(160, 160, 160, 0.5);
        padding: 4px 0 4px 16px;
        font-style: italic;
    }
}

//themes
.large-text {
    &.main-article {
        .abstract {
            font-size: 18px;
            .text-editor {
                font-size: 18px;
            }
        }
        .text-editor {
            //font-size: 18px !important;
            p {
                font-size: 18px !important;
            }
        }
        .headline {
            font-size:28px;
            .text-editor {
                font-size:28px;
            }
        }
    }
}

.dark-theme {
    &.main-article {
        @include dark-theme();
        .text-editor,
        .headline,
        .abstract,
        .dateline input,
        .dateline select,
        input,
        .text-editor p {
            color: $dark-theme-text !important;
        }
        .field label {
            background: var(--sd-editor-colour__field-label-bg);
            color: var(--sd-editor-colour__field-label-txt);
        }
    }

    .sderror {
        border-bottom-color: #FF3D3D;
        background-color: rgba(255, 61, 61, 0.25);
        color: $dark-theme-bg !important;
    }
}

.dark-theme-mono {
    &.main-article {
        @include dark-theme-mono();
        .text-editor,
        .headline,
        .abstract,
        .dateline input,
        .dateline select,
        input,
        .text-editor p {
            color: $dark-theme-text !important;
            font-family: $monoFontFamily;
        }
        .field label {
            background: var(--sd-editor-colour__field-label-bg);
            color: var(--sd-editor-colour__field-label-txt);
        }
    }


    .sderror {
        border-bottom-color: #FF3D3D;
        background-color: rgba(255, 61, 61, 0.25);
        color: $dark-theme-bg !important;
    }
}

.dark-blue-theme {
    &.main-article {
        @include dark-blue-theme();
        .text-editor,
        .headline,
        .abstract,
        .dateline input,
        .dateline select,
        input,
        .text-editor p {
            color: $dark-blue-theme-text !important;
        }
        .field label {
            background: var(--sd-editor-colour__field-label-bg);
            color: var(--sd-editor-colour__field-label-txt);
        }
    }

    .sderror {
        border-bottom-color: #FF3D3D;
        background-color: rgba(255, 61, 61, 0.25);
        color: $dark-blue-theme-bg !important;
    }
}

.natural-theme {
    &.main-article {
        @include natural-theme();
        .text-editor,
        .headline,
        .abstract,
        .dateline input,
        .dateline select,
        input {
            color: $natural-theme-text !important;
        }
    }

    .sderror {
        color: $natural-theme-bg !important;
    }
}

.dark-khaki-theme {
    &.main-article {
        @include dark-khaki-theme();
        .text-editor,
        .headline,
        .abstract,
        .dateline input,
        .dateline select,
        input {
            color: $dark-khaki-theme-text !important;
        }
    }

    .sderror {
        color: $dark-khaki-theme-bg !important;
    }
}

.dark-turquoise-theme {
    &.main-article {
        @include dark-turquoise-theme();
        .text-editor,
        .headline,
        .abstract,
        .dateline input,
        .dateline select,
        input {
            color: $dark-turquoise-theme-text !important;
        }
    }

    .sderror {
        color: $dark-turquoise-theme-bg !important;
    }
}

.pale-yellow-theme {
    &.main-article {
        @include pale-yellow-theme();
        .text-editor,
        .headline,
        .abstract,
        .dateline input,
        .dateline select,
        input {
            color: $pale-yellow-theme-text !important;
        }
    }

    .sderror {
        color: $pale-yellow-theme-bg !important;
    }
}