mirror of
https://github.com/chinchang/web-maker.git
synced 2025-07-12 17:46:26 +02:00
styling fixes
This commit is contained in:
@ -2,6 +2,7 @@ import React, { useState, useEffect } from 'react';
|
|||||||
import firebase from 'firebase/app';
|
import firebase from 'firebase/app';
|
||||||
import 'firebase/storage';
|
import 'firebase/storage';
|
||||||
import { Stack } from './Stack';
|
import { Stack } from './Stack';
|
||||||
|
import { copyToClipboard } from '../utils';
|
||||||
|
|
||||||
const Assets = () => {
|
const Assets = () => {
|
||||||
const [files, setFiles] = useState([]);
|
const [files, setFiles] = useState([]);
|
||||||
@ -22,8 +23,12 @@ const Assets = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
setIsUploading(true);
|
setIsUploading(true);
|
||||||
|
const metadata = {
|
||||||
|
cacheControl: 'public, max-age=3600' // 1 hr
|
||||||
|
};
|
||||||
|
|
||||||
const fileRef = storageRef.child(file.name);
|
const fileRef = storageRef.child(file.name);
|
||||||
const task = fileRef.put(file);
|
const task = fileRef.put(file, metadata);
|
||||||
|
|
||||||
task.on(
|
task.on(
|
||||||
'state_changed',
|
'state_changed',
|
||||||
@ -125,14 +130,9 @@ const Assets = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const copyFileUrl = url => {
|
const copyFileUrl = url => {
|
||||||
const input = document.createElement('input');
|
copyToClipboard(url).then(() => {
|
||||||
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!');
|
alertsService.add('File URL copied!');
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -36,7 +36,18 @@ export function ItemTile({
|
|||||||
aria-label="Remove"
|
aria-label="Remove"
|
||||||
onClick={onRemoveBtnClick}
|
onClick={onRemoveBtnClick}
|
||||||
>
|
>
|
||||||
X
|
<svg
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
fill="none"
|
||||||
|
stroke="currentColor"
|
||||||
|
strokeWidth="3.5"
|
||||||
|
strokeLinecap="round"
|
||||||
|
strokeLinejoin="round"
|
||||||
|
>
|
||||||
|
<line x1="18" y1="6" x2="6" y2="18"></line>
|
||||||
|
<line x1="6" y1="6" x2="18" y2="18"></line>
|
||||||
|
</svg>
|
||||||
</button>
|
</button>
|
||||||
) : null}
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
|
@ -94,9 +94,20 @@ const Modal = ({
|
|||||||
aria-label="Close modal"
|
aria-label="Close modal"
|
||||||
data-testid="closeModalButton"
|
data-testid="closeModalButton"
|
||||||
title="Close"
|
title="Close"
|
||||||
class="js-modal__close-btn modal__close-btn"
|
class="js-modal__close-btn dialog__close-btn modal__close-btn"
|
||||||
>
|
>
|
||||||
Close
|
<svg
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
fill="none"
|
||||||
|
stroke="currentColor"
|
||||||
|
strokeWidth="3.5"
|
||||||
|
strokeLinecap="round"
|
||||||
|
strokeLinejoin="round"
|
||||||
|
>
|
||||||
|
<line x1="18" y1="6" x2="6" y2="18"></line>
|
||||||
|
<line x1="6" y1="6" x2="18" y2="18"></line>
|
||||||
|
</svg>
|
||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
{children}
|
{children}
|
||||||
|
@ -157,11 +157,22 @@ export default function SavedItemPane({
|
|||||||
>
|
>
|
||||||
<button
|
<button
|
||||||
onClick={onCloseIntent}
|
onClick={onCloseIntent}
|
||||||
class="btn saved-items-pane__close-btn"
|
class="btn dialog__close-btn saved-items-pane__close-btn"
|
||||||
id="js-saved-items-pane-close-btn"
|
id="js-saved-items-pane-close-btn"
|
||||||
aria-label={i18n._(t`Close saved creations pane`)}
|
aria-label={i18n._(t`Close saved creations pane`)}
|
||||||
>
|
>
|
||||||
X
|
<svg
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
fill="none"
|
||||||
|
stroke="currentColor"
|
||||||
|
strokeWidth="3.5"
|
||||||
|
strokeLinecap="round"
|
||||||
|
strokeLinejoin="round"
|
||||||
|
>
|
||||||
|
<line x1="18" y1="6" x2="6" y2="18"></line>
|
||||||
|
<line x1="6" y1="6" x2="18" y2="18"></line>
|
||||||
|
</svg>
|
||||||
</button>
|
</button>
|
||||||
<div
|
<div
|
||||||
class="flex flex-v-center"
|
class="flex flex-v-center"
|
||||||
|
9
src/components/Stack.jsx
Normal file
9
src/components/Stack.jsx
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
const gaps = [0, '0.5rem', '1rem', '1.5rem', '3rem', '5rem'];
|
||||||
|
|
||||||
|
export const Stack = ({ gap = 0, children }) => {
|
||||||
|
return (
|
||||||
|
<div class="stack" style={{ gap: gaps[gap] }}>
|
||||||
|
{children}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
@ -3,6 +3,8 @@
|
|||||||
--color-text-dark-1: #b3aec4;
|
--color-text-dark-1: #b3aec4;
|
||||||
--color-bg: #252637;
|
--color-bg: #252637;
|
||||||
--color-popup: #3a2b63;
|
--color-popup: #3a2b63;
|
||||||
|
--color-overlay: rgba(3, 8, 27, 0.7);
|
||||||
|
--color-close-btn: #d12b4a;
|
||||||
--code-font-size: 16px;
|
--code-font-size: 16px;
|
||||||
--color-button: #d3a447;
|
--color-button: #d3a447;
|
||||||
--color-focus-outline: #d3a447;
|
--color-focus-outline: #d3a447;
|
||||||
@ -935,6 +937,20 @@ body > #demo-frame {
|
|||||||
/* border-radius: 4px; */
|
/* 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 {
|
.modal {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: 0;
|
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 {
|
.modal__close-btn:hover {
|
||||||
opacity: 0.7;
|
opacity: 0.7;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.modal__close-btn {
|
||||||
|
right: 0rem;
|
||||||
|
bottom: calc(100% + 0.2rem);
|
||||||
|
transition: 0.25s ease;
|
||||||
|
}
|
||||||
.modal__content {
|
.modal__content {
|
||||||
background: var(--color-popup);
|
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);
|
color: var(--color-text);
|
||||||
position: relative;
|
position: relative;
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
@ -995,9 +1003,9 @@ body > #demo-frame {
|
|||||||
font-size: 1.1em;
|
font-size: 1.1em;
|
||||||
line-height: 1.4;
|
line-height: 1.4;
|
||||||
max-width: 85vw;
|
max-width: 85vw;
|
||||||
margin: 2rem auto;
|
margin: 4rem auto 2rem;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
overflow-y: auto;
|
/* overflow-y: auto; */
|
||||||
pointer-events: auto;
|
pointer-events: auto;
|
||||||
transform: scale(0.98);
|
transform: scale(0.98);
|
||||||
animation: anim-modal var(--duration-modal-show) cubic-bezier(0.4, 0, 0.2, 1)
|
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;
|
z-index: 5;
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
will-change: opacity;
|
will-change: opacity;
|
||||||
background: rgba(0, 0, 0, 0.5);
|
background: var(--color-overlay);
|
||||||
transition: opacity var(--duration-modal-overlay-show);
|
transition: opacity var(--duration-modal-overlay-show);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1072,7 +1080,7 @@ body > #demo-frame {
|
|||||||
padding: 20px 30px;
|
padding: 20px 30px;
|
||||||
z-index: 6;
|
z-index: 6;
|
||||||
visibility: hidden; /* prevents tabbing */
|
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: 0.3s cubic-bezier(1, 0.13, 0.21, 0.87);
|
||||||
transition-property: transform;
|
transition-property: transform;
|
||||||
will-change: transform;
|
will-change: transform;
|
||||||
@ -1093,23 +1101,16 @@ body > #demo-frame {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.saved-items-pane__close-btn {
|
.saved-items-pane__close-btn {
|
||||||
position: absolute;
|
|
||||||
left: -18px;
|
left: -18px;
|
||||||
top: 24px;
|
top: 24px;
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
visibility: hidden;
|
visibility: hidden;
|
||||||
border-radius: 50%;
|
|
||||||
padding: 10px 14px;
|
|
||||||
background: crimson;
|
|
||||||
color: white;
|
|
||||||
border: 0;
|
|
||||||
transform: scale(0);
|
transform: scale(0);
|
||||||
will-change: transform, opacity;
|
will-change: transform, opacity;
|
||||||
transition: 0.3s ease;
|
transition: 0.3s ease;
|
||||||
transition-property: transform, opacity;
|
transition-property: transform, opacity;
|
||||||
transition-delay: 0;
|
transition-delay: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.saved-items-pane.is-open .saved-items-pane__close-btn {
|
.saved-items-pane.is-open .saved-items-pane__close-btn {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
transition-delay: 0.4s;
|
transition-delay: 0.4s;
|
||||||
@ -1121,8 +1122,6 @@ body > #demo-frame {
|
|||||||
padding: 20px;
|
padding: 20px;
|
||||||
background-color: rgba(255, 255, 255, 0.06);
|
background-color: rgba(255, 255, 255, 0.06);
|
||||||
position: relative;
|
position: relative;
|
||||||
/*border: 1px solid rgba(255,255,255,0.1);*/
|
|
||||||
margin: 20px 0;
|
|
||||||
display: block;
|
display: block;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
@ -1132,6 +1131,10 @@ body > #demo-frame {
|
|||||||
box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.2);
|
box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.2);
|
||||||
/* animation: slide-left 0.35s ease forwards; */
|
/* animation: slide-left 0.35s ease forwards; */
|
||||||
}
|
}
|
||||||
|
.saved-item-tile + .saved-item-tile {
|
||||||
|
margin-top: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
.saved-item-tile--inline {
|
.saved-item-tile--inline {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
margin-left: 10px;
|
margin-left: 10px;
|
||||||
@ -1209,6 +1212,8 @@ body > #demo-frame {
|
|||||||
.saved-item-tile__btns {
|
.saved-item-tile__btns {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 6px;
|
top: 6px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
right: 8px;
|
right: 8px;
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
@ -1227,14 +1232,21 @@ body > #demo-frame {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.saved-item-tile__btn {
|
.saved-item-tile__btn {
|
||||||
|
display: inline-flex;
|
||||||
padding: 7px 10px;
|
padding: 7px 10px;
|
||||||
color: white;
|
color: white;
|
||||||
border: 0;
|
border: 0;
|
||||||
border-radius: 20px;
|
border-radius: 1in;
|
||||||
|
font-size: 0.8rem;
|
||||||
|
font-weight: 700;
|
||||||
margin-left: 2px;
|
margin-left: 2px;
|
||||||
background: rgba(255, 255, 255, 0.1);
|
background: rgba(255, 255, 255, 0.1);
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
}
|
}
|
||||||
|
.saved-item-tile__btn > svg {
|
||||||
|
width: 1rem;
|
||||||
|
aspect-ratio: 1;
|
||||||
|
}
|
||||||
|
|
||||||
.saved-item-tile__btn:hover {
|
.saved-item-tile__btn:hover {
|
||||||
background: rgba(255, 255, 255, 0.8);
|
background: rgba(255, 255, 255, 0.8);
|
||||||
@ -1257,7 +1269,8 @@ body > #demo-frame {
|
|||||||
.saved-items-pane__container {
|
.saved-items-pane__container {
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
max-height: calc(100vh - 90px);
|
max-height: calc(100vh - 130px);
|
||||||
|
margin-top: 1rem;
|
||||||
scroll-behavior: smooth;
|
scroll-behavior: smooth;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
21
src/utils.js
21
src/utils.js
@ -343,14 +343,16 @@ export function getCompleteHtml(html, css, js, item, isForExport) {
|
|||||||
var externalJs = '',
|
var externalJs = '',
|
||||||
externalCss = '';
|
externalCss = '';
|
||||||
if (item.externalLibs) {
|
if (item.externalLibs) {
|
||||||
externalJs = item.externalLibs.js
|
externalJs = item.externalLibs.js.split('\n').reduce(function (
|
||||||
.split('\n')
|
scripts,
|
||||||
.reduce(function (scripts, url) {
|
url
|
||||||
|
) {
|
||||||
return scripts + (url ? '\n<script src="' + url + '"></script>' : '');
|
return scripts + (url ? '\n<script src="' + url + '"></script>' : '');
|
||||||
}, '');
|
}, '');
|
||||||
externalCss = item.externalLibs.css
|
externalCss = item.externalLibs.css.split('\n').reduce(function (
|
||||||
.split('\n')
|
links,
|
||||||
.reduce(function (links, url) {
|
url
|
||||||
|
) {
|
||||||
return (
|
return (
|
||||||
links +
|
links +
|
||||||
(url ? '\n<link rel="stylesheet" href="' + url + '"></link>' : '')
|
(url ? '\n<link rel="stylesheet" href="' + url + '"></link>' : '')
|
||||||
@ -585,3 +587,10 @@ if (window.IS_EXTENSION) {
|
|||||||
} else {
|
} else {
|
||||||
document.body.classList.add('is-app');
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user