diff --git a/src/components/Assets.jsx b/src/components/Assets.jsx
index 7ebc433..b507ba2 100644
--- a/src/components/Assets.jsx
+++ b/src/components/Assets.jsx
@@ -2,6 +2,7 @@ import React, { useState, useEffect } from 'react';
import firebase from 'firebase/app';
import 'firebase/storage';
import { Stack } from './Stack';
+import { copyToClipboard } from '../utils';
const Assets = () => {
const [files, setFiles] = useState([]);
@@ -22,8 +23,12 @@ const Assets = () => {
}
setIsUploading(true);
+ const metadata = {
+ cacheControl: 'public, max-age=3600' // 1 hr
+ };
+
const fileRef = storageRef.child(file.name);
- const task = fileRef.put(file);
+ const task = fileRef.put(file, metadata);
task.on(
'state_changed',
@@ -125,14 +130,9 @@ const Assets = () => {
};
const copyFileUrl = url => {
- const input = document.createElement('input');
- input.value = url;
- input.style.opacity = 0;
- document.body.appendChild(input);
- input.select();
- document.execCommand('copy');
- document.body.removeChild(input);
- alertsService.add('File URL copied!');
+ copyToClipboard(url).then(() => {
+ alertsService.add('File URL copied!');
+ });
};
return (
diff --git a/src/components/ItemTile.jsx b/src/components/ItemTile.jsx
index 8996380..e569c25 100644
--- a/src/components/ItemTile.jsx
+++ b/src/components/ItemTile.jsx
@@ -36,7 +36,18 @@ export function ItemTile({
aria-label="Remove"
onClick={onRemoveBtnClick}
>
- X
+
) : null}
diff --git a/src/components/Modal.jsx b/src/components/Modal.jsx
index 052b8e9..e0b02c4 100644
--- a/src/components/Modal.jsx
+++ b/src/components/Modal.jsx
@@ -94,9 +94,20 @@ const Modal = ({
aria-label="Close modal"
data-testid="closeModalButton"
title="Close"
- class="js-modal__close-btn modal__close-btn"
+ class="js-modal__close-btn dialog__close-btn modal__close-btn"
>
- Close
+
)}
{children}
diff --git a/src/components/SavedItemPane.jsx b/src/components/SavedItemPane.jsx
index b158c82..8b13fda 100644
--- a/src/components/SavedItemPane.jsx
+++ b/src/components/SavedItemPane.jsx
@@ -157,11 +157,22 @@ export default function SavedItemPane({
>
{
+ return (
+
+ {children}
+
+ );
+};
diff --git a/src/style.css b/src/style.css
index 743f5de..2b51385 100644
--- a/src/style.css
+++ b/src/style.css
@@ -3,6 +3,8 @@
--color-text-dark-1: #b3aec4;
--color-bg: #252637;
--color-popup: #3a2b63;
+ --color-overlay: rgba(3, 8, 27, 0.7);
+ --color-close-btn: #d12b4a;
--code-font-size: 16px;
--color-button: #d3a447;
--color-focus-outline: #d3a447;
@@ -935,6 +937,20 @@ body > #demo-frame {
/* border-radius: 4px; */
}
+.dialog__close-btn {
+ display: flex;
+ position: absolute;
+ border: none;
+ background: var(--color-close-btn);
+ color: white;
+ border-radius: 0.3rem;
+ padding: 0.4rem 0.5rem;
+}
+.dialog__close-btn > svg {
+ width: 1.2rem;
+ aspect-ratio: 1;
+}
+
.modal {
position: fixed;
top: 0;
@@ -961,32 +977,24 @@ body > #demo-frame {
}
}
-.modal__close-btn {
- position: absolute;
- right: 1rem;
- top: 1rem;
- text-transform: uppercase;
- font-weight: 700;
- font-size: 0.8rem;
- opacity: 0.8;
- transition: 0.25s ease;
- border: 1px solid black;
- border-radius: 2px;
- padding: 0.2rem 0.5rem;
-}
-
-.modal__close-btn > svg {
- fill: black;
- width: 30px;
- height: 30px;
-}
-
.modal__close-btn:hover {
opacity: 0.7;
}
+.modal__close-btn {
+ right: 0rem;
+ bottom: calc(100% + 0.2rem);
+ transition: 0.25s ease;
+}
.modal__content {
background: var(--color-popup);
+
+ /* fix me */
+ background: linear-gradient(45deg, #2d063c, #3a2b63);
+ box-shadow:
+ inset 1px -1px 0 0 #ffffff17,
+ 0 20px 31px 0 #0000008a;
+
color: var(--color-text);
position: relative;
border-radius: 5px;
@@ -995,9 +1003,9 @@ body > #demo-frame {
font-size: 1.1em;
line-height: 1.4;
max-width: 85vw;
- margin: 2rem auto;
+ margin: 4rem auto 2rem;
box-sizing: border-box;
- overflow-y: auto;
+ /* overflow-y: auto; */
pointer-events: auto;
transform: scale(0.98);
animation: anim-modal var(--duration-modal-show) cubic-bezier(0.4, 0, 0.2, 1)
@@ -1038,7 +1046,7 @@ body > #demo-frame {
z-index: 5;
opacity: 0;
will-change: opacity;
- background: rgba(0, 0, 0, 0.5);
+ background: var(--color-overlay);
transition: opacity var(--duration-modal-overlay-show);
}
@@ -1072,7 +1080,7 @@ body > #demo-frame {
padding: 20px 30px;
z-index: 6;
visibility: hidden; /* prevents tabbing */
- background-color: var(--color-popup);
+ background: var(--color-popup);
transition: 0.3s cubic-bezier(1, 0.13, 0.21, 0.87);
transition-property: transform;
will-change: transform;
@@ -1093,23 +1101,16 @@ body > #demo-frame {
}
.saved-items-pane__close-btn {
- position: absolute;
left: -18px;
top: 24px;
opacity: 0;
visibility: hidden;
- border-radius: 50%;
- padding: 10px 14px;
- background: crimson;
- color: white;
- border: 0;
transform: scale(0);
will-change: transform, opacity;
transition: 0.3s ease;
transition-property: transform, opacity;
transition-delay: 0;
}
-
.saved-items-pane.is-open .saved-items-pane__close-btn {
opacity: 1;
transition-delay: 0.4s;
@@ -1121,8 +1122,6 @@ body > #demo-frame {
padding: 20px;
background-color: rgba(255, 255, 255, 0.06);
position: relative;
- /*border: 1px solid rgba(255,255,255,0.1);*/
- margin: 20px 0;
display: block;
border-radius: 4px;
cursor: pointer;
@@ -1132,6 +1131,10 @@ body > #demo-frame {
box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.2);
/* animation: slide-left 0.35s ease forwards; */
}
+.saved-item-tile + .saved-item-tile {
+ margin-top: 1rem;
+}
+
.saved-item-tile--inline {
display: inline-block;
margin-left: 10px;
@@ -1209,6 +1212,8 @@ body > #demo-frame {
.saved-item-tile__btns {
position: absolute;
top: 6px;
+ display: flex;
+ align-items: center;
z-index: 1;
right: 8px;
opacity: 0;
@@ -1227,14 +1232,21 @@ body > #demo-frame {
}
.saved-item-tile__btn {
+ display: inline-flex;
padding: 7px 10px;
color: white;
border: 0;
- border-radius: 20px;
+ border-radius: 1in;
+ font-size: 0.8rem;
+ font-weight: 700;
margin-left: 2px;
background: rgba(255, 255, 255, 0.1);
text-transform: uppercase;
}
+.saved-item-tile__btn > svg {
+ width: 1rem;
+ aspect-ratio: 1;
+}
.saved-item-tile__btn:hover {
background: rgba(255, 255, 255, 0.8);
@@ -1257,7 +1269,8 @@ body > #demo-frame {
.saved-items-pane__container {
overflow-y: auto;
overflow-x: hidden;
- max-height: calc(100vh - 90px);
+ max-height: calc(100vh - 130px);
+ margin-top: 1rem;
scroll-behavior: smooth;
}
diff --git a/src/utils.js b/src/utils.js
index 050c096..e346d22 100644
--- a/src/utils.js
+++ b/src/utils.js
@@ -343,19 +343,21 @@ export function getCompleteHtml(html, css, js, item, isForExport) {
var externalJs = '',
externalCss = '';
if (item.externalLibs) {
- externalJs = item.externalLibs.js
- .split('\n')
- .reduce(function (scripts, url) {
- return scripts + (url ? '\n' : '');
- }, '');
- externalCss = item.externalLibs.css
- .split('\n')
- .reduce(function (links, url) {
- return (
- links +
- (url ? '\n
' : '')
- );
- }, '');
+ externalJs = item.externalLibs.js.split('\n').reduce(function (
+ scripts,
+ url
+ ) {
+ return scripts + (url ? '\n' : '');
+ }, '');
+ externalCss = item.externalLibs.css.split('\n').reduce(function (
+ links,
+ url
+ ) {
+ return (
+ links +
+ (url ? '\n
' : '')
+ );
+ }, '');
}
var contents =
'\n' +
@@ -585,3 +587,10 @@ if (window.IS_EXTENSION) {
} else {
document.body.classList.add('is-app');
}
+export async function copyToClipboard(text) {
+ try {
+ await navigator.clipboard.writeText(text);
+ } catch (err) {
+ console.error('Failed to copy text: ', err);
+ }
+}