discourse/app/assets/stylesheets/common/base/upload.scss
chapoi f4d4f371e6
UX: fix border-radius on image upload inputs (#32935)
Noticed problems on themes that use border-radius (like Horizon), where
these get the button radius applied, which is too large since, despite
**functioning** like a button, they are essentially inputs and lean more
toward the input styling. Also removed `btn-default` as this element
couldn't be further from a default button if it tried.

| Before | After |
|--------|--------|
| ![CleanShot 2025-05-27 at 11 43
42@2x](https://github.com/user-attachments/assets/fa0aa793-e812-40ed-b142-f47158e2d01b)
| ![CleanShot 2025-05-27 at 11 42
01@2x](https://github.com/user-attachments/assets/bba289e7-3707-4725-925e-a993fec32da8)
|

---------

Co-authored-by: Ella <ella.estigoy@gmail.com>
2025-05-28 08:58:21 +02:00

143 lines
2.8 KiB
SCSS
Vendored

.uploaded-image-preview {
position: relative;
max-width: 400px;
width: 100%;
height: 80px;
margin-bottom: 0.5em;
box-sizing: border-box;
border-radius: var(--d-input-border-radius);
background-origin: content-box;
background-clip: content-box;
.meta {
display: none;
}
.placeholder-overlay {
background-size: contain;
background-repeat: no-repeat;
background-position: left center;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
opacity: 0.2;
pointer-events: none;
box-shadow: inset 0 0 0 var(--space-1) var(--secondary);
}
&:hover .expand-overlay,
&:focus-within .expand-overlay {
opacity: 1;
pointer-events: auto;
}
}
.has-image {
.uploaded-image-preview {
background-size: contain;
background-repeat: no-repeat;
background-position: left center;
border: 1px solid var(--primary-low-mid);
padding: var(--space-1);
&:focus,
&:focus-within {
border-color: var(--tertiary);
outline: 2px solid var(--tertiary);
outline-offset: -2px;
}
}
.image-upload-controls {
margin-top: var(--space-2);
}
}
.no-image .uploaded-image-preview {
position: relative;
border: 1px dashed var(--primary-medium);
background-color: var(--primary-very-low);
&:focus,
&:focus-within {
border-color: var(--tertiary);
outline: 2px dashed var(--tertiary);
outline-offset: -2px;
}
.image-upload-controls {
height: 100%;
background-color: var(--primary-very-low);
transition: background 0.25s;
border-radius: var(--d-input-border-radius);
&:hover {
background-color: var(--tertiary-very-low);
}
label {
display: flex;
font-weight: normal;
color: var(--primary-very-high);
width: 100%;
height: 100%;
box-sizing: border-box;
border-radius: var(--d-input-border-radius);
svg {
color: var(--primary-high);
}
}
}
}
.expand-overlay {
position: absolute;
top: 10px;
right: 10px;
z-index: 30;
opacity: 0;
transition: opacity 0.3s ease;
pointer-events: none;
}
.progress-status {
position: absolute;
top: 60%;
left: 50%;
transform: translate(-50%, -50%);
width: 90%;
.progress-bar-container {
--d-border-radius: 10px;
background: var(--primary-low-mid);
border-radius: var(--d-border-radius);
height: 5px;
position: relative;
.progress-bar {
border-radius: var(--d-border-radius);
height: 100%;
background: var(--tertiary);
transition: width 0.3s ease;
position: absolute;
left: 0;
top: 0%;
}
}
span {
font-size: var(--font-down-2);
margin-top: 8px;
display: block;
text-align: center;
color: var(--primary-high);
}
}
.hidden-upload-field {
visibility: hidden;
position: absolute;
}