From 437ffba378c8833903970fbb361063bb5250ed94 Mon Sep 17 00:00:00 2001 From: Cassie Tarakajian Date: Wed, 16 Jan 2019 12:35:34 -0500 Subject: [PATCH] fixes #802 (#809) --- client/images/share.svg | 11 ++++++++ .../modules/IDE/components/CopyableInput.jsx | 25 +++++++++++++++---- client/modules/IDE/components/ShareModal.jsx | 6 +++++ client/styles/abstracts/_placeholders.scss | 6 +++++ client/styles/components/_copyable-input.scss | 17 ++++++++++++- server/routes/embed.routes.js | 1 + 6 files changed, 60 insertions(+), 6 deletions(-) create mode 100644 client/images/share.svg diff --git a/client/images/share.svg b/client/images/share.svg new file mode 100644 index 00000000..ce86d12e --- /dev/null +++ b/client/images/share.svg @@ -0,0 +1,11 @@ + + + + + + + + diff --git a/client/modules/IDE/components/CopyableInput.jsx b/client/modules/IDE/components/CopyableInput.jsx index 9d1c9bec..f2a5e797 100644 --- a/client/modules/IDE/components/CopyableInput.jsx +++ b/client/modules/IDE/components/CopyableInput.jsx @@ -1,6 +1,10 @@ import PropTypes from 'prop-types'; import React from 'react'; import Clipboard from 'clipboard'; +import InlineSVG from 'react-inlinesvg'; +import classNames from 'classnames'; + +import shareUrl from '../../../images/share.svg'; class CopyableInput extends React.Component { constructor(props) { @@ -34,8 +38,12 @@ class CopyableInput extends React.Component { value, hasPreviewLink } = this.props; + const copyableInputClass = classNames({ + 'copyable-input': true, + 'copyable-input--with-preview': hasPreviewLink + }); return ( -
+
+ {hasPreviewLink && + + + + }
); } diff --git a/client/modules/IDE/components/ShareModal.jsx b/client/modules/IDE/components/ShareModal.jsx index 3fede218..e0962624 100644 --- a/client/modules/IDE/components/ShareModal.jsx +++ b/client/modules/IDE/components/ShareModal.jsx @@ -19,6 +19,11 @@ class ShareModal extends React.PureComponent { label="Embed" value={``} /> +
diff --git a/client/styles/abstracts/_placeholders.scss b/client/styles/abstracts/_placeholders.scss index 317a0330..dd71f9d2 100644 --- a/client/styles/abstracts/_placeholders.scss +++ b/client/styles/abstracts/_placeholders.scss @@ -87,11 +87,17 @@ border-color: getThemifyVariable('button-background-hover-color'); background-color: getThemifyVariable('button-background-hover-color'); color: getThemifyVariable('button-hover-color'); + & g { + fill: getThemifyVariable('button-hover-color'); + } } &:enabled:active { border-color: getThemifyVariable('button-background-active-color'); background-color: getThemifyVariable('button-background-active-color'); color: getThemifyVariable('button-active-color'); + & g { + fill: getThemifyVariable('button-active-color'); + } } } } diff --git a/client/styles/components/_copyable-input.scss b/client/styles/components/_copyable-input.scss index fa1ab9bb..2bd5c476 100644 --- a/client/styles/components/_copyable-input.scss +++ b/client/styles/components/_copyable-input.scss @@ -13,6 +13,9 @@ .copyable-input__value { width: 100%; font-size: #{16 / $base-font-size}rem; + .copyable-input--with-preview & { + border-radius: 2px 0 0 2px; + } } .copyable-input__label { @@ -32,7 +35,6 @@ .copyable-input { padding-bottom: #{30 / $base-font-size}rem; display: flex; - flex-wrap: wrap; } .copyable-input__value-container { @@ -56,3 +58,16 @@ border-top-color: getThemifyVariable('button-background-hover-color'); } } + +.copyable-input__preview { + @extend %button; + @include themify() { + align-self: flex-end; + border-radius: 0 2px 2px 0; + padding: #{2 / $base-font-size}rem 0; + } + & svg { + height: #{30 / $base-font-size}rem; + width: #{30 / $base-font-size}rem; + } +} diff --git a/server/routes/embed.routes.js b/server/routes/embed.routes.js index 637097e1..c2c81d2a 100644 --- a/server/routes/embed.routes.js +++ b/server/routes/embed.routes.js @@ -4,6 +4,7 @@ import * as EmbedController from '../controllers/embed.controller'; const router = new Router(); router.get('/:username/embed/:project_id', EmbedController.serveProject); +router.get('/:username/present/:project_id', EmbedController.serveProject); router.get('/embed/:project_id', EmbedController.serveProject); export default router;