TryGhost/Ghost

View on GitHub
ghost/admin/app/styles/components/uploader.css

Summary

Maintainability
Test Coverage
/* gh-file-input
/* ---------------------------------------------------------- */

/* Hide the original input */
.x-file--input {
    width: 1px;
    height: 0;
    max-width: 0;
    opacity: 0;
    overflow: hidden;
    z-index: -1;
}

.x-file--input + label {
    display: inline-block;
    cursor: pointer;
}

.x-file--input:focus + label {
    outline: 1px dotted #000;
    outline: -webkit-focus-ring-color auto 5px;
}

.x-file--input + label * {
    pointer-events: none;
}

/* Image Uploader
/* ---------------------------------------------------------- */

.gh-image-uploader {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    min-height: 140px;
    overflow: hidden;
    margin: 1.6em 0;
    color: var(--middarkgrey);
    text-align: center;
    border-radius: 3px;
}

.gh-image-uploader.-drag-over {
    border: 2px solid var(--green);
}

.gh-image-uploader.-with-image {
    background: transparent !important;
    border: none !important;
}

.gh-image-uploader img {
    display: block;
    min-width: 200px;
    max-width: 100%;
    margin: 0 auto;
    line-height: 0;
}

.image-action {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 300;
    display: block;
    display: flex;
    align-items: center;
    padding: 8px;
    color: #fff;
    font-size: 13px;
    line-height: 10px;
    text-decoration: none;
    background: rgba(0, 0, 0, 0.6);
    border-radius: var(--border-radius);
    box-shadow: rgba(255, 255, 255, 0.2) 0 0 0 1px;
}

.image-edit {
    margin-right: 42px;
}

.image-action svg {
    width: 13px;
    height: 13px;
    margin: 0 !important;
}

.image-edit:hover {
    background: var(--middarkgrey);
}

.image-delete:hover {
    color: #fff;
    cursor: pointer;
    background: var(--red);
}

.gh-image-uploader .upload-form {
    flex-grow: 1;
    display: flex;
    flex-direction: row;
    width: 100%;
}

.gh-image-uploader .x-file-input {
    flex-grow: 1;
    display: flex;
    width: 100%;
}

.gh-image-uploader .x-file-input label {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    outline: none;
}

.gh-image-uploader .description {
    width: 100%;
    font-size: 1.6rem;
    text-align: center;
}

.gh-image-uploader .failed {
    margin: 1em 2em;
    font-size: 16px;
    color: color-mod(var(--midgrey));
}

/* TODO: remove the gh-image-uploader classes once it's using gh-progress-bar */
.gh-image-uploader .progress-container,
.gh-progress-container {
    flex-grow: 1;
    display: flex;
    flex-direction: row;
    align-items: center;
    width: 100%;
}

.gh-image-uploader .progress,
.gh-progress-container-progress {
    width: 60%;
    overflow: hidden;
    margin: 0 auto;
    background: linear-gradient(to bottom, #f5f5f5, #f9f9f9);
    border-radius: 12px;
}

.gh-image-uploader .bar,
.gh-progress-bar {
    height: 8px;
    background: var(--green);
}

.gh-image-uploader .bar.fail,
.gh-progress-bar.-error {
    width: 100% !important;
    background: var(--red);
}

.gh-image-uploader .bar.hidden {
    display: none;
}


/* Unsplash Button
/* ---------------------------------------------------------- */

.gh-image-uploader-unsplash {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 36px;
    height: 36px;
    padding: 10px;
    opacity: 0.33;
    transition: opacity 0.3s ease;
}

.gh-image-uploader-unsplash:hover {
    cursor: pointer;
    opacity: 1.0;
    transition: opacity 0.3s ease;
}

.gh-image-uploader-unsplash svg {
    width: 14px;
}