diff --git a/src/index.html b/src/index.html index 5673db2..9efe859 100644 --- a/src/index.html +++ b/src/index.html @@ -6,643 +6,27 @@ - +
- + Add library - + New - + Save - + Open diff --git a/src/script.js b/src/script.js index 4d547ba..211afe1 100644 --- a/src/script.js +++ b/src/script.js @@ -707,7 +707,7 @@ settingsBtn, onboardModal, notificationsBtn */ layoutBtn3.addEventListener('click', function () { saveSetting('layoutMode', 3); toggleLayout(3); return false; }); utils.onButtonClick(helpBtn, function () { - onboardModal.classList.toggle('is-modal-visible'); + helpModal.classList.toggle('is-modal-visible'); document.body.classList[onboardModal.classList.contains('is-modal-visible') ? 'add' : 'remove']('overlay-visible'); trackEvent('ui', 'helpButtonClick'); }); @@ -766,7 +766,7 @@ settingsBtn, onboardModal, notificationsBtn */ if (e.target.classList.contains('js-saved-item-tile')) { setTimeout(function () { openItem(e.target.dataset.itemId); - }, 300); + }, 350); toggleSavedItemsPane(); } if (e.target.classList.contains('js-saved-item-tile__close-btn')) { @@ -819,13 +819,13 @@ settingsBtn, onboardModal, notificationsBtn */ }); window.addEventListener('keydown', function (event) { - // Implement Ctrl + S + // Ctrl/⌘ + S if ((event.ctrlKey || event.metaKey) && (event.keyCode === 83)) { event.preventDefault(); - saveFile(); - trackEvent('ui', 'saveFileKeyboardShortcut'); + saveItem(); + trackEvent('ui', 'saveItemKeyboardShortcut'); } - // Implement Ctrl + O + // Ctrl/⌘ + O else if ((event.ctrlKey || event.metaKey) && (event.keyCode === 79)) { event.preventDefault(); openSavedItemsPane(); diff --git a/src/style.css b/src/style.css new file mode 100644 index 0000000..7d5a329 --- /dev/null +++ b/src/style.css @@ -0,0 +1,616 @@ +@font-face { + font-family: 'Inconsolata'; + font-style: normal; + font-weight: 400; + src: local('Inconsolata'), url(../Inconsolata-Regular.ttf) format('truetype'); + unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000; +} +:root { + --color-bg: #252637; + --color-sidebar: #3A2B63; +} +body { + margin: 0; + padding: 0; + background: rgba(0, 0, 0, 0.5); + background: var(--color-bg); + color: rgba(255,255,255,0.9); + min-height: 100vh; + font-family: Helvetica, arial; +} +h1 { + margin-top: 0; +} +a { text-decoration: none; color: crimson; cursor: pointer; } +/*a:hover { text-decoration: underline; }*/ + +.flex { display: flex; } +.flex-grow { flex-grow: 1; } +.flex-v-center { align-items: center; } +.fr { float: right; } +.relative { position: relative; } +.tac { text-align: center; } +.full-width { width: 100%; } + +[class*="hint--"]:after { + text-transform: none; +} +.caret { + display: inline-block; + width: 0; + height: 0; + border: 6px solid transparent; + border-top-color: currentColor; + position: relative; + top: 5px; + margin-left: 8px; +} +a > svg { + fill: rgba(255, 255, 255, 0.2) +} +select, input[type="text"], textarea { + padding: 3px 5px; + font-size: inherit; +} +.btn { + display: inline-block; + border: 0; + background: #0074d9; + color: white; + font-size: inherit; + border-radius: 3px; + padding: 7px 15px; + cursor: pointer; + transition: 0.2s ease; +} +.btn:hover { + text-decoration: none; + box-shadow: 0 3px 5px 0 rgba(0,0,0,0.15); +} +.star:after { + content: '★'; + color: #eee333; +} +.main-container { + position: absolute; + left: 0; right: 0; + top: 0; bottom: 0; + display: flex; + flex-direction: column; + will-change: -webkit-filter; + transition: 0.10s ease 0.2s; +} +.overlay-visible .main-container { + transition-duration: 0.5s; + transition-delay: 0.4s; + -webkit-filter: blur(3px); +} +.code-side, +.demo-side { + flex-basis: inherit; + position: relative; +} +.layout-3 .content-wrap { + flex-direction: row-reverse; +} +.code-side { + display: flex; + flex-direction: column; + width: 50%; +} +.layout-2 .content-wrap { + flex-direction: column; +} +.layout-2 .code-side { + flex-direction: row; + width: auto; +} +.code-wrap { + display: flex; + flex-direction: column; + flex-basis: inherit; + height: 33%; + overflow: hidden; + position: relative; + background: var(--color-bg); + transition: height 0.30s ease, width 0.30s ease; + will-change: height; +} +.layout-2 .code-wrap.is-minimized { + flex-direction: row; +} +.is-dragging .code-wrap { + transition: none; +} +.layout-2 .code-wrap { + height: auto; + width: 33%; +} +.code-wrap:nth-of-type(3) { + animation-delay: 0.3s; +} +.code-wrap:nth-of-type(5) { + animation-delay: 0.4s; +} + +.code-wrap__header { + display: flex; + flex-shrink: 0; + justify-content: space-between; + align-items: center; + padding: 5px 10px; + background: rgba(0,0,0,0.20); + color: #888; + border-bottom: 1px solid rgba(0,0,0,0.3); + font-weight: bold; +} +.code-wrap__header-label { + /*transform: translate(0px) scale(1.2);*/ + display: inline-block; + font-size: 1.3em; + opacity: 0.5; + /*transform-origin: left center;*/ +} +.layout-2 .is-minimized .code-wrap__header { + writing-mode: vertical-lr; + padding: 10px 5px; +} +.code-wrap__header .caret { + transition: 0.2s ease; +} +.is-minimized .code-wrap__header .caret { + opacity: 0; + transform: translateY(10px); +} +.code-wrap__header-btn { + width: 18px; + height: 18px; + display: inline-block; +} +.code-wrap__collapse-btn:before { + content: url('data:image/svg+xml;utf8,'); +} +.is-minimized .code-wrap__collapse-btn:before { + content: url('data:image/svg+xml;utf8,'); +} +@keyframes pop-in { + from { transform: scale(0.9); opacity: 0; } + to { transform: scale(1); opacity: 1; } +} + +/* Codemirror */ +.Codemirror { + width: 100%; + height: calc(100% - 25px); /* 25px for header */ + font-size: 16px; +} +.layout-2 .is-minimized .Codemirror { + height: calc(100%); +} +.Codemirror pre { + font-family: 'Inconsolata', monospace; +} +.cm-s-monokai .CodeMirror-linenumber { + color:rgba(255,255,255,0.2); +} +.cm-s-monokai.CodeMirror, +.cm-s-monokai .CodeMirror-gutters { + background: var(--color-bg); +} + +#demo-frame { + border: 0; + width: 100%; + height: 100%; + position: absolute; + z-index: 1; + background: white; +} +.main-header, +.footer { + padding: 5px 10px; + background-color: rgba(0, 0, 0, 0.5); + color: rgba(255, 255, 255, 0.45); + border-top: 1px solid rgba(255,255,255,0.14); + line-height: 20px; +} +.main-header { + border: 0; + border-bottom: 1px solid rgba(255,255,255,0.14); +} +.main-header__btn-wrap > a { + font-size: 0.8em; + color: #9297B3; + border-radius: 3px; + border: 1px solid rgba(146, 151, 179, 0.33); + margin-left: 10px; + padding: 0px 5px; + text-transform: uppercase; +} +.main-header__btn-wrap > a > svg { + fill: #9297B3; + margin-right: 4px; +} +.main-header__btn-wrap > a:hover { + border-color: rgba(146, 151, 179, 0.5); +} +.logo { + display: inline-block; + height: 25px; + width: 48px; + margin-right: 5px; + background: url(icon-48.png) 0px -12px; + background-repeat: no-repeat; + vertical-align: middle; + -webkit-filter: grayscale(0.9); + transition: 0.4s ease; +} +.footer:hover .logo { + -webkit-filter: grayscale(0); +} +.footer__right { + font-size: 0; + line-height: 0; +} +.footer__separator { + display: inline-block; + height: 24px; + margin: 0 10px 0 20px; + border-left: 1px solid rgba(255,255,255,0.2); +} +.mode-btn { + margin-left: 10px; + display: inline-block; +} +.footer__link:first-of-type { + margin-left: 5px; +} +.footer__link { + display: inline-block; + margin-right: 5px; + position: relative; + top: 2px; +} +.footer a > svg { + transition: 0.3s ease; + fill: rgba(255, 255, 255, 0.2) +} +.footer a:hover svg { + fill: rgba(255, 255, 255, 0.45) +} +.mode-btn svg { + width: 24px; + height: 24px; +} +.mode-btn.selected svg { + fill: rgba(255, 255, 255, 0.45); +} +.gutter { + background: rgba(255, 255, 255, 0.05); + flex-shrink: 0; +} +.gutter-horizontal { + cursor: ew-resize; +} +.gutter-vertical { + cursor: ns-resize; +} +.item-title-input { + background: none; + border: 0; + color: rgba(255,255,255,0.6); + width: calc(100vw - 400px); +} +.modal { + position: fixed; + top: 5vh; + left: 50%; + width: 60vw; + margin-left: -30vw; + max-width: 90vw; + height: auto; + z-index: 2000; + visibility: hidden; +} +@media screen and (max-width: 900px) { + .modal { + width: 90vw; + margin-left: -45vw; + } +} +.modal__content { + background: #fdfdfd; + color: #444; + position: relative; + border-radius: 3px; + margin: 0 auto; + opacity: 0; + padding: 2em; + font-size: 1.3em; + max-height: 82vh; + overflow-y: auto; + transition: all 0.19s; + transform: translateY(-50px) scale(0.7); +} +.is-modal-visible { + visibility: visible; +} +.is-modal-visible .modal__content { + transition-duration: 0.3s; + transform: translateY(0px) scale(1); + opacity: 1; +} +.modal-overlay { + position: fixed; + width: 100%; + height: 100%; + visibility: hidden; + top: 0; + left: 0; + z-index: 5; + opacity: 0; + will-change: opacity; + background: rgba(0,0,0,0.6); + transition: all 0.3s; +} +.saved-items-pane { + position: fixed; + right: 0; + top: 0; + bottom: 0; + width: 400px; + padding: 20px 30px; + z-index: 6; + background-color: var(--color-sidebar); + transition: 0.3s cubic-bezier(1, 0.13, 0.21, 0.87); + will-change: transform; + transform: translateX(100%); +} +.saved-items-pane.is-open { + transition-duration: 0.4s; + transform: translateX(0); +} +.is-modal-visible ~ .modal-overlay, +.saved-items-pane.is-open ~ .modal-overlay { + opacity: 1; + visibility: visible; +} +.saved-items-pane__close-btn { + position: absolute; + left: -18px; + top: 24px; + opacity: 0; + visibility: hidden; + border-radius: 50%; + padding: 10px 14px; + background: crimson; + transform: scale(0); + will-change: transform, opacity; + transition: 0.3s ease; + transition-delay: 0; +} +.saved-items-pane.is-open .saved-items-pane__close-btn { + opacity: 1; + transition-delay: 0.4s; + transform: scale(1); + visibility: visible; +} +.saved-item-tile { + 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; + opacity: 0; + transform: translateX(50px); + will-change: opacity, transform; + box-shadow: 0 2px 4px 0 rgba(0,0,0,0.2); + animation: slide-left 0.35s ease forwards; +} +.saved-item-tile:nth-child(1) { animation-delay: 0.2s; } +.saved-item-tile:nth-child(2) { animation-delay: 0.25s; } +.saved-item-tile:nth-child(3) { animation-delay: 0.3s; } +.saved-item-tile:nth-child(4) { animation-delay: 0.35s; } +.saved-item-tile:nth-child(5) { animation-delay: 0.4s; } +.saved-item-tile:nth-child(6) { animation-delay: 0.45s; } +.saved-item-tile:nth-child(7) { animation-delay: 0.5s; } +.saved-item-tile:nth-child(8) { animation-delay: 0.55s; } +.saved-item-tile:nth-child(9) { animation-delay: 0.6s; } +.saved-item-tile:nth-child(10) { animation-delay: 0.65s; } +.saved-item-tile:nth-child(11) { animation-delay: 0.7s; } +.saved-item-tile:nth-child(12) { animation-delay: 0.75s; } +.saved-item-tile:nth-child(n+12) { animation-delay: 0.8s; } +@keyframes slide-left { + from { + opacity: 0; + transform: translateX(50px); + } + to { + opacity: 1; + transform: translateX(0px); + } +} +.saved-item-tile:hover { + background: rgba(255,255,255,0.1); +} +.saved-item-tile__close-btn { + padding: 7px 10px; + position: absolute; + right: 8px; + top: 6px; + z-index: 1; + color: rgba(255,255,255,0.3); + border-radius: 50%; + background: rgba(255,255,255,0.05); +} +.saved-item-tile__close-btn:hover { + background: rgba(255,255,255,0.8); + color: #555; +} +.saved-item-tile__title { + font-size: 1.6em; + margin: 0 0 1em 0; + opacity: 0.8; +} +.saved-item-tile__meta { + opacity: 0.3; +} +.saved-items-pane__container { + overflow-y: scroll; + max-height: calc(100vh - 90px); +} +.notifications-btn { + position: relative; +} +@keyframes shake { + 2%, 22% { + transform: translate3d(-1px, 0, 0); + } + 5%,20% { + transform: translate3d(2px, 0, 0); + } + 7%, 12%, 17% { + transform: translate3d(-4px, 0, 0); + } + 10%, 15% { + transform: translate3d(4px, 0, 0); + } +} +.notifications-btn.has-new { + animation: shake 10s linear infinite; + transform-origin: 50% 10px; +} +.notifications-btn__dot { + position: absolute; + right: 1; + top: -2px; + background: #2fbe3d; + border-radius: 50%; + width: 12px; + height: 12px; + display: none; +} +.has-new .notifications-btn__dot { + display: block; +} +.notification { + border: 1px solid #f1f1f1; + border-radius: 5px; + padding: 20px; + background: #f8f6f9; + position: relative; +} +.notification:not(:last-child) { + margin-bottom: 10px; +} +.notification li:not(:last-child) { + margin-bottom: 10px; +} +.notification__version { + background: #ff8c00; + color: white; + padding: 3px; + border-radius: 5px; + position: absolute; + top: 2px; + left: 2px; +} +.btn-group { + position: relative; + cursor: pointer; +} +.dropdown__menu { + position: absolute; + top: 100%; + left: 0; + padding: 0; + margin: 0; + min-width: 200px; + display: block; + list-style: none; + border-radius: 4px; + overflow: hidden; + opacity: 0; + visibility: hidden; + transition: 0.25s ease; + transform: translateY(10px); + z-index: 5; + background: white; +} +.dropdown__menu > li > a { + display: block; + padding: 15px; + color: #333; + cursor: pointer; +} +.dropdown__menu > li > a:hover { + background: var(--color-sidebar); + color: white; +} +.dropdown__menu > li:not(:last-child) { + border-bottom: 1px solid rgba(0,0,0,0.05); +} + +.open .dropdown__menu { + opacity: 1; + visibility: visible; + transform: translateY(0); +} +.alerts-container { + position: fixed; + will-change: transform; + left: 50%; + top: 0; + padding: 10px; + background: var(--color-sidebar); + border-radius: 3px; + z-index: 6; + transform: translateY(-100%); + transition: 0.3s ease; +} +.alerts-container.is-active { + transform: translateY(0); +} + +.error-gutter { + width: 8px; +} +.gutter-error-marker { + width: 8px; + height: 20px; + background: red; + border-radius: 0; + position: relative; + top: 0; + left: 1px; +} +.gutter-error-marker:after { + content: attr(data-title); + background: red; + color: white; + padding: 4px; + opacity: 0; + visibility: hidden; + position: absolute; + top: 14px; + left: 0px; + white-space: nowrap; + transform: translateX(-10px); + will-change: transform; + transition: 0.2s ease; +} +.gutter-error-marker:hover:after { + opacity: 1; + visibility: visible; + transform: translateX(0); +} +.count-label { + color: rgba(0,0,0,0.8); + background: rgba(255,255,255,0.53); + border-radius: 5px; + padding: 1px 6px; + font-weight: bold; +} \ No newline at end of file