favycon/components/drag-and-drop/index.module.scss

741 lines
10 KiB
SCSS

@import '../../styles/variables.scss';
.root {
position: relative;
width: 100%;
max-width: 476px;
min-height: 360px;
background: $white;
border-radius: 8px;
box-shadow: 0 2px 4px rgba($black, 0.12);
transition: background 0.2s ease;
@include breakpoint-md {
max-width: 100%;
height: 100%;
border-radius: 0;
}
&.transparent {
@include breakpoint-md {
background: transparent;
}
}
}
:global(.dark) .root {
background: $dark-black;
&.transparent {
@include breakpoint-md {
background: transparent;
}
}
}
.container {
padding: 24px 24px 20px;
pointer-events: all;
border-radius: 8px;
transition: opacity 0.2s ease;
&.loading {
pointer-events: none;
opacity: 0.32;
}
@include breakpoint-md {
display: flex;
flex-direction: column;
width: 100%;
height: calc(100% - 68px);
margin-top: 68px;
border-radius: 0;
}
&.transparent {
@include breakpoint-md {
padding: 0;
}
}
}
.dashed {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 1;
border-radius: 6px;
rect {
transition: all 0.2s ease;
animation: dash 0.75s linear infinite forwards;
animation-play-state: paused;
}
&.dragActive rect {
stroke: $link;
animation-play-state: running;
}
}
:global(.dark) .dashed {
rect {
stroke: #495c70;
}
&.dragActive rect {
stroke: $off-white-dark;
}
}
.dropZoneWrapper {
position: relative;
height: 244px;
margin-bottom: 16px;
text-align: center;
background: $off-white;
border-radius: 6px;
transition: background 0.2s ease;
@include breakpoint-md {
flex-grow: 1;
margin-bottom: 0;
background: transparent;
border-radius: 0;
}
&:hover {
cursor: pointer;
.dashed rect {
stroke: $link;
}
}
}
:global(.dark) .dropZoneWrapper {
background: $dark-grey;
@include breakpoint-md {
background: transparent;
}
&:hover {
.dashed rect {
stroke: $off-white-dark;
}
}
}
@keyframes dash {
0% {
stroke-dashoffset: 0;
}
100% {
stroke-dashoffset: -20;
}
}
.dropZoneFooter {
transition: background 0.2s ease;
@include breakpoint-md {
padding: 16px 24px 24px;
padding-bottom: env(safe-area-inset-bottom);
background: rgba($white, 0.88);
border-radius: 16px 16px 0 0;
box-shadow: 0 -2px 4px rgba($black, 0.12);
@supports (padding: max(1px)) {
padding-bottom: max(24px, env(safe-area-inset-bottom));
}
p {
font-size: 15px;
}
}
}
:global(.dark) .dropZoneFooter {
@include breakpoint-md {
background: rgba($dark-black, 0.88);
}
}
.dropZone {
position: relative;
z-index: 2;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
width: 100%;
height: 100%;
&:focus {
outline: none;
}
}
.imageUpload {
margin-bottom: 20px;
}
.imageUploadText {
height: 48px;
span {
display: inline-block;
overflow: hidden;
white-space: nowrap;
}
&.dragActive {
height: 48px;
}
@include breakpoint-md {
font-size: 16px;
font-weight: 600;
line-height: 28px;
color: $off-white-dark;
}
&.mobileUploadText {
@include breakpoint-md-up {
display: none;
}
}
&.desktopUploadText {
/* smartphones, touchscreens */
@media (hover: none) and (pointer: coarse) {
display: none;
}
@include breakpoint-md {
display: none;
}
}
}
:global(.dark) .imageUploadText {
color: $white-dark;
@include breakpoint-md {
color: $off-white-dark;
}
}
.info {
display: flex;
align-items: flex-start;
margin-top: 8px;
letter-spacing: 0.2px;
svg {
flex: 0 0 20px;
margin-right: 8px;
@include breakpoint-md {
height: 24px;
}
}
strong {
font-weight: 700;
}
}
:global(.dark) .info {
color: $off-white-dark;
}
.imagePreviewWrapper {
display: flex;
align-items: center;
margin-bottom: 24px;
}
.imagePreview {
position: relative;
display: flex;
flex: 0 0 48px;
align-items: center;
justify-content: center;
width: 48px;
height: 48px;
margin-right: 16px;
border: 1px solid transparent;
border-radius: 4px;
box-shadow: 0 2px 4px rgba($black, 0.12);
&.notSquare {
background: rgba($red, 0.2);
border: 1px solid rgba($black, 0.08);
}
img {
position: absolute;
top: -1px;
left: -1px;
width: 48px;
height: 48px;
border-radius: 4px;
object-fit: contain;
}
}
.imagePreviewInfo {
width: calc(100% - 64px);
}
.filenameWrapper {
display: flex;
}
.filename {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.fileSize {
flex-shrink: 0;
margin-left: 2px;
}
.imageInfo {
display: flex;
flex-wrap: wrap;
padding: 16px 0;
border-top: 1px solid $light-grey;
transition: all 0.2s ease;
}
:global(.dark) .imageInfo {
border-top: 1px solid $dark-grey;
}
.imageOptionsWrapper {
padding: 8px 0 16px;
border-top: 1px solid $light-grey;
transition: all 0.2s ease;
@include breakpoint-md {
padding: 24px 0;
}
}
:global(.dark) .imageOptionsWrapper {
border-top: 1px solid $dark-grey;
}
.imageInfoItem {
display: flex;
align-items: center;
margin-right: 24px;
span {
margin-right: 8px;
}
@include breakpoint-md {
margin-top: 8px;
margin-bottom: 8px;
}
}
.imageOptions {
display: flex;
flex-wrap: wrap;
padding: 8px 0 16px;
.imageInfoItem {
@include breakpoint-md {
margin-top: 0;
margin-bottom: 24px;
}
}
}
.pwaCheck {
width: 12px;
height: 12px;
margin-right: 8px;
transition: opacity 0.2s ease-in-out;
&.hide {
opacity: 0;
}
}
.imagePreviewDownload {
display: flex;
align-items: center;
justify-content: center;
margin: 16px 0 12px;
@include breakpoint-md {
align-items: flex-end;
}
}
.preview {
position: relative;
width: 40px;
height: 40px;
margin-right: 12px;
background: $white;
box-shadow: 0 2px 4px rgba($black, 0.12);
@include breakpoint-md {
width: 96px;
height: 96px;
margin-right: 0;
}
img {
width: 40px;
height: 40px;
object-fit: contain;
@include breakpoint-md {
width: 96px;
height: 96px;
}
}
&.circle,
&.circle img {
border-radius: 24px;
@include breakpoint-md {
width: 52px;
height: 52px;
border-radius: 26px;
}
}
&.circle {
@include breakpoint-md {
z-index: 1;
transform: translate3d(21px, 3px, 0);
}
}
&.square,
&.square img {
width: 48px;
height: 48px;
border-radius: 4px;
@include breakpoint-md {
width: 96px;
height: 96px;
border-radius: 8px;
}
}
&.rounded,
&.rounded img {
margin-right: 0;
border-radius: 14px;
@include breakpoint-md {
width: 40px;
height: 40px;
border-radius: 13px;
}
}
&.rounded {
@include breakpoint-md {
z-index: 1;
transform: translate3d(-12px, 3px, 0);
}
}
}
:global(.dark) .preview {
background: $off-white-dark;
}
.imagePreviewTitle {
margin-bottom: 4px;
text-align: center;
}
.imagePreviewSubtitle {
max-width: 348px;
margin: 0 auto;
margin-bottom: 42px;
text-align: center;
letter-spacing: 0.2px;
}
.imageInfoItemSvg {
margin-right: 8px;
letter-spacing: 0.2px;
}
.showCode {
margin-left: 12px;
&:hover {
color: $link;
}
}
:global(.dark) .showCode:hover {
color: $off-white-dark;
}
.imageFooter {
position: absolute;
right: 0;
bottom: 0;
display: flex;
align-items: center;
justify-content: flex-end;
width: 100%;
padding: 23px 24px 24px;
border-top: 1px solid $light-grey;
transition: all 0.2s ease;
&.spaceBetween {
justify-content: space-between;
}
@include breakpoint-md {
flex-direction: column-reverse;
padding: 11px 24px 12px;
border-top: 1px solid transparent;
> * {
margin-bottom: 12px;
}
}
@include breakpoint-xs {
align-items: stretch;
}
}
:global(.dark) .imageFooter {
border-top: 1px solid $dark-grey;
@include breakpoint-md {
border-top: 1px solid transparent;
}
}
.makeNewOne {
&:hover {
color: $link;
text-decoration: none;
}
}
:global(.dark) .makeNewOne {
&:hover {
color: $off-white-dark;
}
}
.reUpload {
&:hover {
color: $link;
text-decoration: none;
}
}
:global(.dark) .reUpload {
&:hover {
color: $off-white-dark;
}
}
.imageGenerate {
margin-left: 24px;
@include breakpoint-md {
margin-left: 0;
}
}
.modalContainer {
max-width: 730px;
height: 100%;
margin: 0 auto;
touch-action: none;
@include breakpoint-md {
padding-top: 20px;
}
}
.modalHeader {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 10px;
}
.modalHeaderMobile {
display: none;
padding: 36px 32px 8px;
margin-bottom: 0;
@include breakpoint-md {
display: flex;
background: $dark-black;
border-top-left-radius: 20px;
border-top-right-radius: 20px;
}
}
.modalHeaderDesktop {
@include breakpoint-md {
display: none;
}
}
.overlay {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 10;
background-color: rgba($white, 0.64);
}
:global(.dark) .overlay {
background-color: rgba($black, 0.8);
}
.content {
position: absolute;
top: 50%;
left: 50%;
width: 100%;
max-width: 730px;
height: 100%;
max-height: 538px;
padding: 2px 0 0;
overflow: auto;
background: transparent;
border: none;
border-radius: 0;
outline: none;
transform: translate(-50%, -50%);
-webkit-overflow-scrolling: touch;
@include breakpoint-md {
max-height: 100vh;
padding: 0;
}
}
.copyWrapper {
position: relative;
&::before {
position: absolute;
top: 50%;
left: 0;
padding-right: 16px;
font-size: $font-size-title;
font-weight: 700;
line-height: $line-height-title;
color: $link;
letter-spacing: 0.2px;
content: 'Copied!';
opacity: 0;
transition: all 0.2s ease;
transform: translate(-100%, -50%);
}
&.copied::before {
opacity: 1;
}
}
:global(.dark) .copyWrapper::before {
color: $off-white-dark;
}
.modalCode {
position: relative;
height: 100%;
max-height: 488px;
padding: 28px;
color: $white;
background: $dark-black;
border-radius: 8px;
@include breakpoint-md {
max-height: calc(100% - 84px);
border-radius: 0;
}
&::before {
z-index: 2;
@include breakpoint-md {
position: absolute;
right: -1px;
bottom: 28px;
left: 0;
height: 136px;
content: '';
background: linear-gradient(to bottom, rgba($dark-black, 0), rgba($dark-black, 1));
}
}
.copyWrapper {
z-index: 3;
display: none;
@include breakpoint-md {
position: absolute;
right: 24px;
bottom: 80px;
left: 24px;
display: block;
button {
width: 100%;
}
}
}
pre {
position: relative;
z-index: 1;
@include breakpoint-md {
max-height: calc(100% - 68px);
padding-bottom: 104px;
}
}
pre code {
@include breakpoint-md {
white-space: pre-wrap;
}
}
}
.modalCodeTitle {
display: none;
@include breakpoint-md {
display: block;
margin-bottom: 20px;
}
}