superdesk/superdesk-client-core

View on GitHub
scripts/core/upload/styles/upload.scss

Summary

Maintainability
Test Coverage
// uploader.scss
// Styling for the superdesk upload submodule (avatar upload, media upload)
// ----------------------------------------------------------------------------------------
@import '~mixins.scss';
@import '~variables.scss';
@import "~sf-additional.scss";

@mixin generic-upload-progress($height:2px) {
    position: absolute;
    height: $height;
    inset-block-start: 0; inset-inline-start: 0; inset-inline-end: 0;
    z-index: 1;
    background: var(--sd-item__main-Bg);
    .bar {
        height: $height;
        background: var(--sd-colour-interactive);
    }
}

/*
======================================
user avatar uploader
======================================
*/
.upload-avatar {
    .modal-body {
        position: relative;
    }
    .sidebar {
        width: 200px;
        display: flex;
        flex-direction: column;

        .split-popup__nav-item {
            border-block-end: 1px solid var(--sd-colour-line--x-light);
            padding-inline-start: 16px;
            padding-inline-end: 12px;
            display: flex;
            align-items: center;
            justify-content: flex-start;
            height: 40px;
            font-size: calc(var(--text-size--base) * 1.2);
            a {
                color: var(--sd-colour-interactive);
                text-decoration: none;
            }
            [class^="icon-"] {
                margin-inline-end: $sd-base-increment;
                opacity: 0.75;
                color: inherit;
            }
            &:hover {
                background-color: var(--sd-colour-interactive--alpha-20);
                cursor: pointer;
            }
            &.active {
                background-color: var(--sd-colour-interactive--alpha-10);
                color: var(--sd-colour-interactive);
                a {
                    color: var(--sd-colour-interactive);
                }
                [class^="icon-"] {
                    opacity: 1;
                }
            }
            &.remove-avatar {
                margin-block-start: auto;
                border-block-start: 1px solid var(--sd-colour-line--x-light);
                border-block-end: none;
                display: flex;
                flex-direction: column;
                align-items: flex-start;
                padding-block-start: 6px;
                padding-block-end: 6px;
                height: auto;
                gap: 2px;
                .remove-avatar__inner {
                    display: flex;
                }
                small {
                    font-size: 12px;
                    color: var(--color-text-lighter);
                }
            }
        }
    }
    .main {
        padding: 20px;
        overflow: auto;
        position: relative;
        .computer {
            height: 100%;
            .dropzone {
                height: 100%;
                border: 2px dashed var(--sd-colour-line--light);
                display: flex;
                flex-direction: column;
                justify-content: center;
                .text {
                    text-align: center;
                    color: var(--color-text-light);
                    font-size: 30px;
                    @include text-light();
                }
                .input-holder {
                    text-align: center;
                    margin: 30px auto 0;
                    width: 170px;
                    input {
                        width: 100%;
                        height: auto;
                        cursor: pointer !important;
                    }
                    input::-webkit-file-upload-button {
                      visibility: hidden;
                    }
                    input[type="file"] {
                        padding-block-start: 4px;
                        font-size: 13px;
                        background-color: transparent;
                        height: 32px;
                        color: var(--color-text);
                    }
                    input:before {
                        content: attr(label);
                        display: inline-block;
                        background: -webkit-linear-gradient(top, #f9f9f9, #fff);
                        border: 1px solid #d0d0d0;
                        border-radius: 2px;
                        padding: 0 10px;
                        outline: none;
                        white-space: nowrap;
                        -webkit-user-select: none;
                        text-shadow: 1px 1px #fff;
                        font-size: 12px;
                        color: #787878;
                        @include box-sizing(border-box);
                        width: 100%;
                        text-align: center;
                        cursor: pointer !important;
                    }
                    input:focus {
                        outline: none !important;
                    }
                    input:hover:before {
                        border-color: #c0c0c0;
                        cursor: pointer !important;
                    }
                    input:active:before {
                        background: -webkit-linear-gradient(top, #e3e3e3, #f9f9f9);
                        outline: none;
                    }
                }
            }
        }

        .camera {
            video {
                @include box-sizing(border-box);
                width: 100%;
            }
        }

        $avatar-crop-area-width: 300px;
        .preview {
            .crop-area {
                position: absolute;
                inset-block-start: 50px;
                inset-inline-start: 20px; inset-inline-end: 20px; inset-block-end: 20px;
                .original {
                    position: absolute;
                    inset-inline-start: 0; inset-block-start:0; inset-block-end: 0;
                    width: $avatar-crop-area-width;
                    img {
                        width: 100%;
                    }
                }
                .preview {
                    position: absolute;
                    inset-inline-end: 0; inset-block-start:0; inset-block-end: 0;
                    inset-inline-start: $avatar-crop-area-width;
                    .preview-large {
                        width:120px;
                        height: 120px;
                        overflow: hidden;
                        margin: 0 15px 30px 15px;
                    }
                    .preview-large-4-3-small {
                        width:300px;
                        height: 225px;
                        overflow: hidden;
                        margin: 0 15px 30px 35px;
                        float: inline-end;
                    }
                    .preview-large-4-3-medium {
                        width:400px;
                        height: 300px;
                        overflow: hidden;
                        margin: 0 15px 30px 35px;
                        float: inline-end;
                    }
                    .preview-large-4-3-large {
                        width:800px;
                        height: 600px;
                        overflow: hidden;
                        margin: 0 15px 30px 35px;
                        float: inline-end;
                    }
                    .preview-large-16-9-small {
                        width:300px;
                        height: 169px;
                        overflow: hidden;
                        margin: 0 15px 30px 35px;
                        float: inline-end;
                    }
                    .preview-large-16-9-medium {
                        width:400px;
                        height: 225px;
                        overflow: hidden;
                        margin: 0 15px 30px 35px;
                        float: inline-end;
                    }
                    .preview-large-16-9-large {
                        width:1280px;
                        height: 720px;
                        overflow: hidden;
                        margin: 0 15px 30px 35px;
                        float: inline-end;
                    }
                    .preview-round {
                        width:60px;
                        height: 60px;
                        overflow: hidden;
                        margin: 0 45px 30px 45px;
                        @include border-radius(30px);
                    }
                }
                &.image {
                    inset-block-start: 200px;
                    .loading {
                        background: url('~images/loading-large.gif') no-repeat center;
                    }
                }
            }
            .cords-label {
                color: #999;
            }
        }
    }
}

.upload-progress {
    @include generic-upload-progress();
}



/*
======================================
media uploader
======================================
*/
.upload-media {

    .modal__body {
        display: flex;
        flex-direction:column;
        overflow-x: hidden !important;
        padding: 0 !important;
    }
    .drag-area { //start screen on modal show
        position: absolute;
        inset-block-start:0;
        inset-inline-start: 0;
        inset-block-end: 0;
        inset-inline-end: 0;
        overflow-y: auto;
        border: none !important;
        @include user-select(none);
    }

    .upload-edit {    //detail upload screen and basic edit
        z-index: 1;
        padding: 20px;
        flex: 1 1 auto;
        overflow-y: auto;
        position: relative;
        &.error {
            inset-block-start: 40px;
        }

        .upload-thumbs {
            .flex-grid__item {
                min-height: 350px;
                .thumb {
                    border-radius: 3px 3px 0 0;
                    overflow: hidden;
                    position: relative;
                    .holder {
                        height: 200px;
                        background-color: $grayLighter;
                        position: relative;
                        line-height: 205px;
                        i {
                            position: absolute;
                            inset-block-start: 50%;
                            margin-block-start: -25px;
                            inset-inline-start: 50%;
                            margin-inline-start: -30px;
                            opacity: 0.2;
                            z-index: 1;
                        }
                        img {
                            width: 100%;
                            position: relative;
                            z-index: 2;
                            display: inline-block;
                            vertical-align: middle;
                        }
                        .failed {
                            position: absolute;
                            inset-inline-start: 0; inset-inline-end: 0; inset-block-start:0 ; inset-block-end:0;
                            z-index: 2;
                            background: rgba(255,255,255,0.7) url('~images/icon_upload_error_big.png') no-repeat center center;
                        }
                    }

                    .remove {
                        position: absolute;
                        inset-block-start: 0px; inset-inline-end: 0px;
                        height: 20px;
                        width: 20px;
                        background: #fff;
                        opacity: 0.4;
                        text-align: center;
                        line-height: 20px;
                        z-index: 2;
                        &:hover {
                            cursor: pointer;
                            opacity: 0.9;
                            i {
                                opacity: 0.5;
                            }
                        }
                    }
                }
                .info {
                    position: relative;
                    padding-block-start: 2px;
                    padding-block-end: 3px;
                    border-block-start: 1px solid var(--sd-colour-line--medium);
                    border-radius: 0 0 3px 3px;

                    .upload-progress {
                        @include generic-upload-progress();
                        inset-block-start:-1px;
                    }

                    input[type="text"] {
                        width: 100%;
                        color: var(--color-text);
                        border: 0;
                        border-block-end: 1px solid var(--color-input-border);
                        font-size: 1.4rem;
                        background-color: var(--color-input-bg);
                        transition: all 0.3s cubic-bezier(0.55, 0, 0.55, 0.2);
                        padding: 0 0.8rem;
                        height: 3.2rem;
                        border-radius: var(--b-radius--x-small) var(--b-radius--x-small) 0 0;
                        display: block;
                        &:hover {
                            border-color: var(--color-input-border-hover);
                            background-color: var(--color-input-bg--hover);
                        }
                        &:focus {
                            box-shadow: 0 1px 0 0 var(--sd-colour-interactive);
                            border-color: var(--sd-colour-interactive);
                            background-color: var(--sd-colour-interactive--alpha-20);
                        }
                    }
                    label {
                        padding: 0;
                        line-height: 14px;
                        color: var(--color-text-light);
                    }

                    .btn--mini {
                        position: absolute;
                        inset-inline-end: 4px;
                        inset-block-start: 4px;
                        border: 0;
                        background: none;
                        display: none;
                        width: 18px;
                        height: 18px;
                        padding: 2px;
                    }

                    .form__row {
                        line-height: 18px;
                        position: relative;
                        padding: 3px 6px;
                        &:hover {
                            .btn--mini {
                                display: block;
                            }
                        }
                    }


                    .other-info {
                        z-index: 5;
                        background: #fff;
                        .row {
                            &.shadow {
                                background: #f4f4f4;
                                border-top-width: 2px;
                            }
                            .text {
                                color: #999;
                                font-size: 13px;
                            }
                        }
                    }
                }
            }
        }
    }
}

/*
======================================
edit image modal
======================================
*/
.modal-body__flex {
    &--disabled {
        position: relative;
        &:after {
            content: '';
            position: absolute;
            inset-block-start: 0;
            inset-block-end: 0;
            inset-inline-start: 0;
            inset-inline-end: 0;
            background-color: rgba(255,255,255, .8);
            z-index: 999;
        }
    }
    display: flex;
    flex-direction: column;
    padding: 0 !important;
    overflow-y: hidden !important;
    &-top {
        display: flex;
        flex: 1;
    }
    &-bottom {
        background-color: #dedede;
        border-block-start: 1px solid #d5d5d5;
        padding: 15px 8px 0 8px;
        @include box-sizing(border-box);
        flex: 0 0 auto;
    }
    &-main {
        flex: 1;
        overflow: auto;
        padding: 4px 20px 0px 20px;
        @include box-sizing(border-box);
        label {
            color: #808080;
            span.size {
                color: black;
                font-weight: 500;
                margin-inline-start: 10px;
            }
        }
        button {
            margin-block-start: 10px;
            margin-inline-end: 8px;
        }
    }
    &-sidebar {
        width: 335px;
        overflow-y: auto;
        background-color: #f0f0f0;
        border-inline-start: 1px solid #dfdfdf;
        @include box-sizing(border-box);
        padding: 15px;
    }
    &-loader:before {
        content: '';
        position: absolute;
        inset-block-start: 100px;
        inset-inline-start: 100px;
        transform: translateY(-50%);
        background-position: left !important;
        @include spinner-big;
    }
    &-metadata {
        > div {
            margin-block-end: 25px;
        }
        label {
            font-size: 11px;
            text-transform: uppercase;
            color: $grayLight;
            line-height: 12px;
        }
        .header {
            font-size: 16px;
        }
    }
}

.crop-area {
    &__thumbnails {
        max-height: 260px;
        overflow-y: auto;
        ul {
            li {
                margin: 0 7px 14px 7px;
                max-width: 160px;
                display: inline-block;
                padding: 10px 10px 0px 10px;
                background-color: #f0f0f0;
                border: 1px solid #d6d6d6;
                @include box-sizing(border-box);
                @include box-shadow(0 1px 0 #d6d6d6);
                @include border-radius(2px);
                vertical-align: top;
                img {
                    max-width: 140px;
                    max-height: 140px;
                }
                &.active {
                    border: 1px solid #b3b3b3;
                    background-color: white;
                    @include box-shadow(0 1px 0 #b3b3b3);
                }
                label {
                    color: #808080;
                }
            }
        }
    }
}
.image-point__image, .crop-area img {
    max-height: 55vh;
}
.image-point {
    &__poi {
        position: absolute;
        inset-block-start: 0;
        inset-inline-start: 0;
        z-index: 1;
        display: inline-block;
        &__overlay {
            position: absolute;
            inset-block-start: 0;
            inset-inline-start: 0;
            inset-inline-end: 0;
            inset-block-end: 0;
            z-index: 3;
            &:hover {
                cursor: crosshair;
            }
        }
        &__cursor {
            width: 30px;
            height: 30px;
            @include border-radius(50%);
            position: absolute;
            z-index: 2;
            border: 2px solid rgba(255,255,255,0.7);
            box-sizing: border-box;
        }
        &__cross-left, &__cross-right, &__cross-top, &__cross-bottom {
            background-color: rgba(255,255,255,0.7);
            position: absolute;
            z-index: 2;
        }
        &__cross-left, &__cross-right {
            height: 2px;
            inset-inline-start: 0;
        }
        &__cross-top, &__cross-bottom {
            width: 2px;
            inset-block-start: 0;
        }
    }
}

.crop-box {
    background: transparent;
    position: absolute;
    inset-block-start: 0;
    inset-inline-start: 0;
    border-color: rgba(0,0,0,.5);
    border-style: solid;
    box-sizing: border-box;
    z-index: 1200;
}

@media only screen and (min-width: 1900px) {
    .crop-area {
        &__thumbnails {
            max-height: 390px;
            ul {
                li {
                    width: 225px;
                    max-width: 225px;
                    height: 177px;
                    img {
                        max-width: 200px;
                        max-height: 132px;
                    }
                }
            }
        }
    }
}