From cf1149b382a1b377b9e6592d216c4a88acdeab90 Mon Sep 17 00:00:00 2001 From: Shawn Date: Sat, 10 Nov 2018 21:57:24 -0600 Subject: [PATCH 01/16] Prototyping --- .../Creatify/EditableFontface/index.js | 68 +++++++++++++++++++ .../components/Creatify/FontFaces/.gitkeep | 0 .../Creatify/FontFaces/GreenMachine.js | 6 ++ .../Creatify/FontFaces/RetroRainbow.js | 18 +++++ .../Creatify/RichDraggable/index.js | 11 +++ client/src/components/Creatify/index.js | 42 ++++++++++++ client/src/pages/HomePage/view.jsx | 3 + 7 files changed, 148 insertions(+) create mode 100644 client/src/components/Creatify/EditableFontface/index.js create mode 100644 client/src/components/Creatify/FontFaces/.gitkeep create mode 100644 client/src/components/Creatify/FontFaces/GreenMachine.js create mode 100644 client/src/components/Creatify/FontFaces/RetroRainbow.js create mode 100644 client/src/components/Creatify/RichDraggable/index.js create mode 100644 client/src/components/Creatify/index.js diff --git a/client/src/components/Creatify/EditableFontface/index.js b/client/src/components/Creatify/EditableFontface/index.js new file mode 100644 index 00000000..4a808d76 --- /dev/null +++ b/client/src/components/Creatify/EditableFontface/index.js @@ -0,0 +1,68 @@ +import React, { Component } from 'react'; + +const DEFAULT_TEXT_RENDER = (text) => text; + +export default class EditableFontface extends Component { + constructor(props) { + super(props); + + this.state = { + value: props.value, + }; + } + + render() { + const me = this; + + const { + value + } = me.state; + + const { + fontFace, + } = me.props; + + const textRender = fontFace.textRender || DEFAULT_TEXT_RENDER; + + const textStyles = { + ...{ + minHeight: '30px', + WebkitFontSmoothing: 'antialiased', + MozOsxFontSmoothing: 'grayscale', + }, + ...(fontFace.text), + }; + + return ( +
+ me.onKeyPress(e)} onChange={(e) => me.onChange(e)} style={{ + ...{ + bottom: 0, + opacity: 0, + padding: 0, + left: 0, + position: 'absolute', + top: 0, + width: '100%', + zIndex: 1, + }, + ...(fontFace.editorStyle || {}), + }} /> +
{textRender(value)}
+
+ ); + } + + onKeyPress(e) { + this.setState({ value: e.target.value }); + } + + onChange(e) { + this.setState({ value: e.target.value }); + } +}; + +export const PRESETS = { + 'Retro Rainbow': require('./FontFaces/RetroRainbow'), + 'Green Machine': require('./FontFaces/GreenMachine'), +} diff --git a/client/src/components/Creatify/FontFaces/.gitkeep b/client/src/components/Creatify/FontFaces/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/client/src/components/Creatify/FontFaces/GreenMachine.js b/client/src/components/Creatify/FontFaces/GreenMachine.js new file mode 100644 index 00000000..24b77af7 --- /dev/null +++ b/client/src/components/Creatify/FontFaces/GreenMachine.js @@ -0,0 +1,6 @@ +export default const GreenMachine = { + container: {}, + text: { + color: 'green', + }, +}; diff --git a/client/src/components/Creatify/FontFaces/RetroRainbow.js b/client/src/components/Creatify/FontFaces/RetroRainbow.js new file mode 100644 index 00000000..dfd15eaf --- /dev/null +++ b/client/src/components/Creatify/FontFaces/RetroRainbow.js @@ -0,0 +1,18 @@ +export default const RetroRainbow = { + container: {}, + editorStyle: { + fontFamily: 'Arial, sans-serif', + fontWeight: 'bold', + transform: 'scale(1, 1.5)', + }, + text: { + fontFamily: 'Arial, sans-serif', + fontWeight: 'bold', + background: 'linear-gradient(to right, #b306a9, #ef2667, #f42e2c, #ffa509, #fdfc00, #55ac2f, #0b13fd, #a804af)', + textFillColor: 'transparent', + backgroundClip: 'text', + transform: 'scale(1, 1.5)', + WebkitTextFillColor: 'transparent', + WebkitBackgroundClip: 'text', + }, +}; diff --git a/client/src/components/Creatify/RichDraggable/index.js b/client/src/components/Creatify/RichDraggable/index.js new file mode 100644 index 00000000..7fa63afb --- /dev/null +++ b/client/src/components/Creatify/RichDraggable/index.js @@ -0,0 +1,11 @@ +import React, { Component } from 'react'; + +export default class RichDraggable extends Component { + render() { + return ( +
+ {this.props.children} +
+ ); + } +}; diff --git a/client/src/components/Creatify/index.js b/client/src/components/Creatify/index.js new file mode 100644 index 00000000..fb45516f --- /dev/null +++ b/client/src/components/Creatify/index.js @@ -0,0 +1,42 @@ +import React, { Component } from 'react'; + +import RichDraggable from './RichDraggable'; +import EditableFontface, { PRESETS as FontPresets } from './EditableFontface'; + +export default class Creatify extends Component { + constructor(props) { + super(props); + + const fontKeys = Object.keys(FontPresets); + + this.state = { + fontName: fontKeys[0], + fontOptions: fontKeys.map((fontName) => ( + + )), + }; + } + + render() { + const { + state, + } = this; + + return ( +
+ + + + +
+ ); + } + + onChangeFont(event) { + this.setState({ + fontName: event.target.value, + }); + } +}; diff --git a/client/src/pages/HomePage/view.jsx b/client/src/pages/HomePage/view.jsx index 36b8a78e..808cc826 100644 --- a/client/src/pages/HomePage/view.jsx +++ b/client/src/pages/HomePage/view.jsx @@ -3,6 +3,8 @@ import PageLayout from '@components/PageLayout'; import PublishTool from '@containers/PublishTool'; import ContentPageWrapper from '@pages/ContentPageWrapper'; +import Creatify from '@components/Creatify'; + class HomePage extends React.Component { componentWillUnmount () { this.props.clearFile(); @@ -16,6 +18,7 @@ class HomePage extends React.Component { pageTitle={'Speech'} pageUri={''} > + ); -- 2.45.2 From ba19d4311dbf125e9633c876dfec3f93bb381b42 Mon Sep 17 00:00:00 2001 From: Shawn Date: Mon, 12 Nov 2018 17:00:35 -0600 Subject: [PATCH 02/16] Update branch --- .../Creatify/EditableFontface/index.js | 21 ++++--- .../Creatify/FontFaces/GreenMachine.js | 2 +- .../Creatify/FontFaces/RetroRainbow.js | 7 +-- .../Creatify/RichDraggable/index.js | 57 ++++++++++++++++++- client/src/components/Creatify/index.js | 51 +++++++++++++++-- 5 files changed, 114 insertions(+), 24 deletions(-) diff --git a/client/src/components/Creatify/EditableFontface/index.js b/client/src/components/Creatify/EditableFontface/index.js index 4a808d76..4050413c 100644 --- a/client/src/components/Creatify/EditableFontface/index.js +++ b/client/src/components/Creatify/EditableFontface/index.js @@ -24,14 +24,13 @@ export default class EditableFontface extends Component { const textRender = fontFace.textRender || DEFAULT_TEXT_RENDER; - const textStyles = { - ...{ - minHeight: '30px', - WebkitFontSmoothing: 'antialiased', - MozOsxFontSmoothing: 'grayscale', - }, - ...(fontFace.text), - }; + const textStyles = Object.assign({ + minHeight: '30px', + WebkitFontSmoothing: 'antialiased', + MozOsxFontSmoothing: 'grayscale', + }, fontFace.text); + + console.log(textStyles); return (
@@ -48,7 +47,7 @@ export default class EditableFontface extends Component { }, ...(fontFace.editorStyle || {}), }} /> -
{textRender(value)}
+
{textRender(value)}
); } @@ -63,6 +62,6 @@ export default class EditableFontface extends Component { }; export const PRESETS = { - 'Retro Rainbow': require('./FontFaces/RetroRainbow'), - 'Green Machine': require('./FontFaces/GreenMachine'), + 'Retro Rainbow': require('../FontFaces/RetroRainbow'), + 'Green Machine': require('../FontFaces/GreenMachine'), } diff --git a/client/src/components/Creatify/FontFaces/GreenMachine.js b/client/src/components/Creatify/FontFaces/GreenMachine.js index 24b77af7..b3163983 100644 --- a/client/src/components/Creatify/FontFaces/GreenMachine.js +++ b/client/src/components/Creatify/FontFaces/GreenMachine.js @@ -1,4 +1,4 @@ -export default const GreenMachine = { +module.exports = { container: {}, text: { color: 'green', diff --git a/client/src/components/Creatify/FontFaces/RetroRainbow.js b/client/src/components/Creatify/FontFaces/RetroRainbow.js index dfd15eaf..c1dd4d8d 100644 --- a/client/src/components/Creatify/FontFaces/RetroRainbow.js +++ b/client/src/components/Creatify/FontFaces/RetroRainbow.js @@ -1,4 +1,4 @@ -export default const RetroRainbow = { +module.exports = { container: {}, editorStyle: { fontFamily: 'Arial, sans-serif', @@ -8,11 +8,10 @@ export default const RetroRainbow = { text: { fontFamily: 'Arial, sans-serif', fontWeight: 'bold', - background: 'linear-gradient(to right, #b306a9, #ef2667, #f42e2c, #ffa509, #fdfc00, #55ac2f, #0b13fd, #a804af)', - textFillColor: 'transparent', + backgroundImage: 'linear-gradient(to right, #b306a9, #ef2667, #f42e2c, #ffa509, #fdfc00, #55ac2f, #0b13fd, #a804af)', backgroundClip: 'text', transform: 'scale(1, 1.5)', - WebkitTextFillColor: 'transparent', + color: 'transparent', WebkitBackgroundClip: 'text', }, }; diff --git a/client/src/components/Creatify/RichDraggable/index.js b/client/src/components/Creatify/RichDraggable/index.js index 7fa63afb..b4de955b 100644 --- a/client/src/components/Creatify/RichDraggable/index.js +++ b/client/src/components/Creatify/RichDraggable/index.js @@ -1,11 +1,62 @@ import React, { Component } from 'react'; +import Draggable from 'react-draggable'; + +let body; +try { + body = document.body; +} catch(e) {} export default class RichDraggable extends Component { + constructor(props) { + super(props); + + this.contents = React.createRef(); + this.state = { + height: 0, + width: 0, + }; + } + + componentDidMount() { + const height = this.contents.current.offsetHeight; + const width = this.contents.current.offsetWidth; + + this.setState({ + height, + width, + }); + } + render() { + const me = this; + + const { + props, + state, + } = me; + + const { + height: bottom, + width: right, + } = props.bounds; + + const bounds = { + top: 0, + left: 0, + right: right - state.width, + bottom: bottom - state.height, + }; + + console.log(bounds); + return ( -
- {this.props.children} -
+ +
+
+ {props.children} +
+
+
); } }; diff --git a/client/src/components/Creatify/index.js b/client/src/components/Creatify/index.js index fb45516f..01217a56 100644 --- a/client/src/components/Creatify/index.js +++ b/client/src/components/Creatify/index.js @@ -3,33 +3,74 @@ import React, { Component } from 'react'; import RichDraggable from './RichDraggable'; import EditableFontface, { PRESETS as FontPresets } from './EditableFontface'; +// TODO: Remove `rasterizehtml` from SSR +let rasterizeHTML = () => {}; +try { + if(window) { + rasterizeHTML = require('rasterizehtml') + } +} catch(e) {} + export default class Creatify extends Component { constructor(props) { super(props); const fontKeys = Object.keys(FontPresets); + this.canvas = React.createRef(); + this.contents = React.createRef(); + this.state = { + bounds: {}, fontName: fontKeys[0], fontOptions: fontKeys.map((fontName) => ( - + )), }; } + componentDidMount() { + const bounds = this.contents.current.getBoundingClientRect(); + + this.setState({ + bounds, + }); + } + + renderContents() { + const me = this; + + const canvas = me.canvas.current; + let contents = me.contents.current.innerHTML; + + // Resolves a bug in Chrome where it renders correctly, but + // replaces the inline styles with an invalid `background-clip` + contents = contents.replace(/background\-clip:(.*)[;$]/g, + (match, group) => (`-webkit-background-clip:${group};${match}`) + ); + + rasterizeHTML.drawHTML(contents, canvas); + } + render() { + const me = this; + const { state, } = this; return ( -
+
+ + - - - +
+ + + +
); } -- 2.45.2 From 1c44a69912d8a2f27a4b36cc47d240d1de673f4b Mon Sep 17 00:00:00 2001 From: Shawn Date: Mon, 12 Nov 2018 18:53:00 -0600 Subject: [PATCH 03/16] Update branch --- .../Creatify/EditableFontface/index.js | 31 ++++++++-------- client/src/components/Creatify/index.js | 35 +++++++++++++------ 2 files changed, 42 insertions(+), 24 deletions(-) diff --git a/client/src/components/Creatify/EditableFontface/index.js b/client/src/components/Creatify/EditableFontface/index.js index 4050413c..7f7664d7 100644 --- a/client/src/components/Creatify/EditableFontface/index.js +++ b/client/src/components/Creatify/EditableFontface/index.js @@ -19,6 +19,7 @@ export default class EditableFontface extends Component { } = me.state; const { + editable = true, fontFace, } = me.props; @@ -30,23 +31,25 @@ export default class EditableFontface extends Component { MozOsxFontSmoothing: 'grayscale', }, fontFace.text); - console.log(textStyles); + const fontInput = (editable === true) ? ( + me.onKeyPress(e)} onChange={(e) => me.onChange(e)} style={{ + ...{ + bottom: 0, + opacity: 0, + padding: 0, + left: 0, + position: 'absolute', + top: 0, + width: '100%', + zIndex: 1, + }, + ...(fontFace.editorStyle || {}), + }} /> + ) : null; return (
- me.onKeyPress(e)} onChange={(e) => me.onChange(e)} style={{ - ...{ - bottom: 0, - opacity: 0, - padding: 0, - left: 0, - position: 'absolute', - top: 0, - width: '100%', - zIndex: 1, - }, - ...(fontFace.editorStyle || {}), - }} /> + {fontInput}
{textRender(value)}
); diff --git a/client/src/components/Creatify/index.js b/client/src/components/Creatify/index.js index 01217a56..013d1ff7 100644 --- a/client/src/components/Creatify/index.js +++ b/client/src/components/Creatify/index.js @@ -1,4 +1,5 @@ import React, { Component } from 'react'; +import Select from 'react-select' import RichDraggable from './RichDraggable'; import EditableFontface, { PRESETS as FontPresets } from './EditableFontface'; @@ -20,12 +21,20 @@ export default class Creatify extends Component { this.canvas = React.createRef(); this.contents = React.createRef(); + const fontOptions = fontKeys.map( + (fontName) => ( + { + value: fontName, + label: , + fontName, + } + ) + ); + this.state = { bounds: {}, fontName: fontKeys[0], - fontOptions: fontKeys.map((fontName) => ( - - )), + fontOptions, }; } @@ -59,13 +68,19 @@ export default class Creatify extends Component { state, } = this; + const options = [ + { value: 'chocolate', label:
Chocolate
}, + { value: 'strawberry', label: 'Strawberry' }, + { value: 'vanilla', label: 'Vanilla' }, + ]; + return (
- - - +
+ + + this.setFont(option.fontName)} /> + this.setFont(option.fontName)} />
-
+
-- 2.45.2 From 63d1de3147397d30ca577739e61d665b465b96d2 Mon Sep 17 00:00:00 2001 From: Shawn Date: Wed, 14 Nov 2018 02:43:47 -0600 Subject: [PATCH 06/16] Refactor, fix rendering edge cases --- .../Creatify/EditableFontface/index.js | 1 + .../Creatify/FontFaces/TheSpecial.js | 41 +++++++ client/src/components/Creatify/index.js | 108 ++++++++---------- 3 files changed, 92 insertions(+), 58 deletions(-) create mode 100644 client/src/components/Creatify/FontFaces/TheSpecial.js diff --git a/client/src/components/Creatify/EditableFontface/index.js b/client/src/components/Creatify/EditableFontface/index.js index 603cb8dd..29866c65 100644 --- a/client/src/components/Creatify/EditableFontface/index.js +++ b/client/src/components/Creatify/EditableFontface/index.js @@ -68,4 +68,5 @@ export const PRESETS = { 'Retro Rainbow': require('../FontFaces/RetroRainbow'), 'Green Machine': require('../FontFaces/GreenMachine'), 'vapor wave': require('../FontFaces/VaporWave'), + 'The Special': require('../FontFaces/TheSpecial'), } diff --git a/client/src/components/Creatify/FontFaces/TheSpecial.js b/client/src/components/Creatify/FontFaces/TheSpecial.js new file mode 100644 index 00000000..d7e5087a --- /dev/null +++ b/client/src/components/Creatify/FontFaces/TheSpecial.js @@ -0,0 +1,41 @@ +import React from 'react'; + +module.exports = { + container: {}, + editorStyle: { + fontFamily: 'Arial, sans-serif', + fontWeight: 'bold', + fontSize: '1.4em', + }, + text: { + fontFamily: 'Arial, sans-serif', + fontWeight: 'bold', + backgroundImage: 'linear-gradient(to right, #b306a9, #ef2667, #f42e2c, #ffa509, #fdfc00, #55ac2f, #0b13fd, #a804af)', + backgroundClip: 'text', + fontSize: '1.4em', + color: 'transparent', + paddingBottom: '.25em', + paddingTop: '.1em', + WebkitBackgroundClip: 'text', + }, + textRender: (text) => { + text = text + .replace(/love [^\s.!$]+/g, 'love LBRY') + .replace(/LBRY/g, 'amazing LBRY') + .replace(/julie/gi, 'super Julie') + .replace(/tom/gi, 'amazing Tom') + .replace(/(btc|bch)/gi, 'LBC') + .replace(/\w+ is \w+/gi, 'LBRY is amazing'); + + return text.split(/chris[\d\w]*/gi).reduce((result, value, index) => { + if(index !== 0) { + result.push(); + } + result.push({value}) + + return result; + }, []) + }, +}; + +const THE_FACE = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJ4AAADMCAMAAAC1Heq1AAADAFBMVEUAAADm2c2bblM0RU3ZrpR9UzrTm4WPYUc6S1RKP0Kjc1d3TjPbsJ+Iemy6jXpNXGeuin0/NTOIXEC1kIS5fmbNo4aOZ1jInIAwNzmognitnJTp4dRXZW1nUkHsz8VPWFN3bmRcbHjMpI/grppqbmnCsaynY1SelpBkd4LjzMKUhHtZX1l2fH/jwK/jqpeKYUdxhZCFVzpveoGNkpBYUUfbtai7k4M7PTaFVzpCRT4pMCz118l7g4esgnjBnZPTtbBVUEXRtaqFWDvQpZiwhXlvcGTBlYXIhm87OzKXdmjnlYu2bV6Jm6GnppuabVOdsK0CAAAAAQwABBXgnGwYAgDgo3flq47Ih1rruI/Zp4/gqJLWppbhsJwBERzRm3vFjW7RpJC9iGTYq5zSkGHRl2zMjV/XlWXZm2zLlGn3upvpsZvprpTsqXngrZbfpo3LlHTispDisqTEjmQCDhTip4bMmnoWJTDCgVbhnXMSISjnpHHhom/8wqXWpYccLjkyJBo8LCDxroGSVzk+IBBJKhnztJSxdE+bXz7vvZbzsobSmnKlbEoDGCLXoI3kpnwgFBDsr47rsYXRoH/EjXnamnq7e1DmrIEOGyQsPUfrqILFlXeU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g+HTaxJI6/NqIRgiKYLgBJLljPaRBfEwx4D3+4iWVh9At+Wd0uFiArSNaW4Uz6LGQaoei6GZ8+kBwQD9tXbBgUQvVF/9OAM6hmwAIomO7jgBE/PksvzrM1gVz6kBrJOEkh1jD4wwUqMx4jtTBtUz6b18uPYyvvm7xCCHz/MqtVRIcbP9RGFF+xoyIN6mlpYXvNuc+6f9/d7gHqe9c595YT34BwJb8NsVLvTgAAAAASUVORK5CYII='; diff --git a/client/src/components/Creatify/index.js b/client/src/components/Creatify/index.js index 9d35e5e6..cc0a54a7 100644 --- a/client/src/components/Creatify/index.js +++ b/client/src/components/Creatify/index.js @@ -4,77 +4,71 @@ import Select from 'react-select' import RichDraggable from './RichDraggable'; import EditableFontface, { PRESETS as FontPresets } from './EditableFontface'; -// TODO: Remove `rasterizehtml` from SSR -let rasterizeHTML = () => {}; -try { - if(window) { - rasterizeHTML = require('rasterizehtml') - } -} catch(e) {} - const getRasterizedCanvas = (contents, width, height) => { return new Promise((resolve) => { + // Parse to xHTML for SVG/foreignObject rendering + contents = new XMLSerializer().serializeToString( + new DOMParser().parseFromString(contents, 'text/html') + ); + // Resolves a bug in Chrome where it renders correctly, but // replaces the inline styles with an invalid `background-clip`. if(/Chrome/.test(navigator.userAgent)) { - contents = contents.replace(/background\-clip:(.*)[;$]/g, - (match, group) => (`-webkit-background-clip:${group};${match}`) + contents = contents.replace(/background\-clip:(\s*text\s*)[;$]/g, + (match, group) => (`-webkit-background-clip:text;${match}`) ); } // Attempt to match font kerning with the DOM. contents = '' + contents; + const svgContents = ` + +${contents} +`; - rasterizeHTML.drawHTML(contents, document.createElement('canvas'), { - width, - height, - }).then((renderResult) => { - const pixelRatio = 2; + const pixelRatio = 2; - // Why do this? Because Firefox doesn't always give us what we expect - // `background-clip: text` is very broken and does not always render in time. - let img = document.createElement('img'); - let canvas = document.createElement('canvas'); + let img = document.createElement('img'); + let canvas = document.createElement('canvas'); - img.height = canvas.height = height * pixelRatio; - img.width = canvas.width = width * pixelRatio; - canvas.style.height = `${height}px`; - canvas.style.width = `${width}px`; + img.height = canvas.height = height * pixelRatio; + img.width = canvas.width = width * pixelRatio; + canvas.style.height = `${height}px`; + canvas.style.width = `${width}px`; - let shadowNode = document.createElement('div'); - Object.assign(shadowNode.style, { - height: 0, - overflow: 'hidden', - width: 0, - }); - document.body.appendChild(shadowNode); - - shadowNode.appendChild(img); - //document.body.appendChild(canvas); - - var svg64 = btoa(unescape(encodeURIComponent(renderResult.svg))); - var b64Start = 'data:image/svg+xml;base64,'; - var image64 = b64Start + svg64; - img.addEventListener('load', () => { - window.requestAnimationFrame(() => { - // We still can't trust Firefox's %$%&* engine, add another 5ms timeout - setTimeout(() => { - let context = canvas.getContext('2d', { alpha: false }); - context.clearRect(0, 0, canvas.width, canvas.height); - context.fillStyle = 'white'; - context.imageSmoothingEnabled = false; - context.scale(pixelRatio, pixelRatio); - context.fillRect(0, 0, canvas.width, canvas.height); - context.drawImage(img, 0, 0); - - document.body.removeChild(shadowNode); - - resolve(canvas); - }, 10); - }); - }); - img.src = image64; + let shadowNode = document.createElement('div'); + Object.assign(shadowNode.style, { + height: 0, + overflow: 'hidden', + width: 0, }); + document.body.appendChild(shadowNode); + + shadowNode.appendChild(img); + + var svg64 = btoa(unescape(encodeURIComponent(svgContents))); + var b64Start = 'data:image/svg+xml;base64,'; + var image64 = b64Start + svg64; + img.addEventListener('load', () => { + window.requestAnimationFrame(() => { + // We still can't trust Firefox's %$%&* engine, add another 5ms timeout + // `background-clip: text` is very broken and does not always render in time. + setTimeout(() => { + let context = canvas.getContext('2d', { alpha: false }); + context.clearRect(0, 0, canvas.width, canvas.height); + context.fillStyle = 'white'; + context.imageSmoothingEnabled = false; + context.scale(pixelRatio, pixelRatio); + context.fillRect(0, 0, canvas.width, canvas.height); + context.drawImage(img, 0, 0); + + document.body.removeChild(shadowNode); + + resolve(canvas); + }, 10); + }); + }); + img.src = image64; }); }; @@ -120,12 +114,10 @@ export default class Creatify extends Component { let contents = me.contents.current.outerHTML; - console.log(contents) // Cheap border/handles removal contents = `` + contents; getRasterizedCanvas(contents, 600, 500).then((element) => { - console.log(element); document.body.appendChild(element); }); } -- 2.45.2 From 8ee57c25e4cb8dc9a27d23c08ccf4a0432ad2789 Mon Sep 17 00:00:00 2001 From: Shawn Date: Wed, 14 Nov 2018 16:06:52 -0600 Subject: [PATCH 07/16] Code cleanup, implement some editing --- client/src/components/Creatify/index.js | 3 +- client/src/containers/Dropzone/view.jsx | 119 ++++++++++++++++++------ client/src/pages/HomePage/view.jsx | 3 - 3 files changed, 90 insertions(+), 35 deletions(-) diff --git a/client/src/components/Creatify/index.js b/client/src/components/Creatify/index.js index cc0a54a7..867183f0 100644 --- a/client/src/components/Creatify/index.js +++ b/client/src/components/Creatify/index.js @@ -124,8 +124,8 @@ export default class Creatify extends Component { render() { const me = this; - const { + props, state, } = this; @@ -139,6 +139,7 @@ export default class Creatify extends Component { + {props.children}
); diff --git a/client/src/containers/Dropzone/view.jsx b/client/src/containers/Dropzone/view.jsx index b524b014..3d9f2743 100644 --- a/client/src/containers/Dropzone/view.jsx +++ b/client/src/containers/Dropzone/view.jsx @@ -1,5 +1,6 @@ import React from 'react'; import { validateFile } from '../../utils/file'; +import Creatify from '@components/Creatify'; import DropzonePreviewImage from '@components/DropzonePreviewImage'; import DropzoneDropItDisplay from '@components/DropzoneDropItDisplay'; import DropzoneInstructionsDisplay from '@components/DropzoneInstructionsDisplay'; @@ -7,11 +8,21 @@ import DropzoneInstructionsDisplay from '@components/DropzoneInstructionsDisplay class Dropzone extends React.Component { constructor (props) { super(props); + this.state = { - dragOver : false, - mouseOver : false, - dimPreview: false, + dragOver : false, + mouseOver : false, + dimPreview : false, + filePreview: null, }; + + if(props.file) { + // No side effects allowed with `getDerivedStateFromProps`, so + // we must use `componentDidUpdate` and `constructor` routines. + // Note: `FileReader` has an `onloadend` side-effect + this.updateFilePreview(); + } + this.handleDrop = this.handleDrop.bind(this); this.handleDragOver = this.handleDragOver.bind(this); this.handleDragEnd = this.handleDragEnd.bind(this); @@ -23,6 +34,25 @@ class Dropzone extends React.Component { this.handleFileInput = this.handleFileInput.bind(this); this.chooseFile = this.chooseFile.bind(this); } + + componentDidUpdate(prevProps) { + if(prevProps.file !== this.props.file) { + this.updateFilePreview(); + } + } + + updateFilePreview() { + if (this.props.file) { + const fileReader = new FileReader(); + fileReader.readAsDataURL(this.props.file); + fileReader.onloadend = () => { + this.setState({ + filePreview: fileReader.result + }); + }; + } + } + handleDrop (event) { event.preventDefault(); this.setState({dragOver: false}); @@ -35,9 +65,11 @@ class Dropzone extends React.Component { } } } + handleDragOver (event) { event.preventDefault(); } + handleDragEnd (event) { var dt = event.dataTransfer; if (dt.items) { @@ -48,27 +80,34 @@ class Dropzone extends React.Component { event.dataTransfer.clearData(); } } + handleDragEnter () { this.setState({dragOver: true, dimPreview: true}); } + handleDragLeave () { this.setState({dragOver: false, dimPreview: false}); } + handleMouseEnter () { this.setState({mouseOver: true, dimPreview: true}); } + handleMouseLeave () { this.setState({mouseOver: false, dimPreview: false}); } + handleClick (event) { event.preventDefault(); document.getElementById('file_input').click(); } + handleFileInput (event) { event.preventDefault(); const fileList = event.target.files; this.chooseFile(fileList[0]); } + chooseFile (file) { if (file) { try { @@ -80,9 +119,49 @@ class Dropzone extends React.Component { this.props.selectFile(file); } } + render () { - const { dragOver, mouseOver, dimPreview } = this.state; + const { dragOver, mouseOver, dimPreview, filePreview } = this.state; const { file, thumbnail, fileError, isUpdate, sourceUrl, fileExt } = this.props; + + const hasContent = !!(file || isUpdate); + + const dropZoneHooks = file ? {} : { + onDrop: this.handleDrop, + onDragOver: this.handleDragOver, + onDragEnd: this.handleDragEnd, + onDragEnter: this.handleDragEnter, + onDragLeave: this.handleDragLeave, + onMouseEnter: this.handleMouseEnter, + onMouseLeave: this.handleMouseLeave, + onClick: this.handleClick, + }; + + const dropZonePreviewProps = file ? { + dimPreview, + file, + thumbnail, + } : { + dimPreview: true, + isUpdate: true, + sourceUrl, + }; + + let memeify = file && filePreview ? ( + + + + ) : null; + + console.log({ + file, + thumbnail, + sourceUrl, + filePreview, + }); + + const dropZoneClassName = 'dropzone' + (dragOver ? ' dropzone--drag-over' : ''); + return ( {isUpdate && fileExt === 'mp4' ? ( @@ -100,31 +179,10 @@ class Dropzone extends React.Component { encType='multipart/form-data' /> -
- {file || isUpdate ? ( +
+ {hasContent ? (
- {file ? ( - - ) : ( - - )} +
{ dragOver ? : null } { mouseOver ? ( @@ -133,13 +191,12 @@ class Dropzone extends React.Component { message={fileExt === 'mp4' ? 'Drag & drop new thumbnail' : null} /> ) : null } + {memeify}
) : ( dragOver ? : ( - + ) )}
diff --git a/client/src/pages/HomePage/view.jsx b/client/src/pages/HomePage/view.jsx index 808cc826..36b8a78e 100644 --- a/client/src/pages/HomePage/view.jsx +++ b/client/src/pages/HomePage/view.jsx @@ -3,8 +3,6 @@ import PageLayout from '@components/PageLayout'; import PublishTool from '@containers/PublishTool'; import ContentPageWrapper from '@pages/ContentPageWrapper'; -import Creatify from '@components/Creatify'; - class HomePage extends React.Component { componentWillUnmount () { this.props.clearFile(); @@ -18,7 +16,6 @@ class HomePage extends React.Component { pageTitle={'Speech'} pageUri={''} > - ); -- 2.45.2 From c5257f90e1b555b458a98d9f518d4cd7f8c95a8c Mon Sep 17 00:00:00 2001 From: Shawn Date: Wed, 14 Nov 2018 18:54:30 -0600 Subject: [PATCH 08/16] Fix flex/dimensions, begin adding toolbar --- client/src/components/Creatify/index.js | 32 +++++++++++++++++++++---- client/src/containers/Dropzone/view.jsx | 13 ++++------ package.json | 3 +++ 3 files changed, 34 insertions(+), 14 deletions(-) diff --git a/client/src/components/Creatify/index.js b/client/src/components/Creatify/index.js index 867183f0..c1ea9e4b 100644 --- a/client/src/components/Creatify/index.js +++ b/client/src/components/Creatify/index.js @@ -1,9 +1,17 @@ +import { library } from '@fortawesome/fontawesome-svg-core' +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' + import React, { Component } from 'react'; import Select from 'react-select' import RichDraggable from './RichDraggable'; import EditableFontface, { PRESETS as FontPresets } from './EditableFontface'; +import { + faFont +} from '@fortawesome/free-solid-svg-icons' +library.add(faFont); + const getRasterizedCanvas = (contents, width, height) => { return new Promise((resolve) => { // Parse to xHTML for SVG/foreignObject rendering @@ -102,22 +110,36 @@ export default class Creatify extends Component { } componentDidMount() { + // TODO: Fix bounds + /* const bounds = this.contents.current.getBoundingClientRect(); this.setState({ bounds, }); + + console.log({ + bounds + }) + */ } renderContents() { const me = this; - let contents = me.contents.current.outerHTML; + const contentsElement = me.contents.current; + let contents = contentsElement.outerHTML; // Cheap border/handles removal contents = `` + contents; - getRasterizedCanvas(contents, 600, 500).then((element) => { + const contentsWidth = contentsElement.offsetWidth; + const contentsHeight = contentsElement.offsetHeight; + + // Fix the dimensions, fixes when flex is used. + contents = `
${contents}
`; + + getRasterizedCanvas(contents, contentsWidth, contentsHeight).then((element) => { document.body.appendChild(element); }); } @@ -130,12 +152,12 @@ export default class Creatify extends Component { } = this; return ( -
-
+
+
this.setFont(option.fontName)} /> + */}
diff --git a/client/src/containers/Dropzone/view.jsx b/client/src/containers/Dropzone/view.jsx index 161e8736..4814e4e7 100644 --- a/client/src/containers/Dropzone/view.jsx +++ b/client/src/containers/Dropzone/view.jsx @@ -1,10 +1,15 @@ import React from 'react'; + import { validateFile } from '../../utils/file'; import Creatify from '@components/Creatify'; import DropzonePreviewImage from '@components/DropzonePreviewImage'; import DropzoneDropItDisplay from '@components/DropzoneDropItDisplay'; import DropzoneInstructionsDisplay from '@components/DropzoneInstructionsDisplay'; +import { library } from '@fortawesome/fontawesome-svg-core' +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' +import { faEdit } from '@fortawesome/free-solid-svg-icons'; + class Dropzone extends React.Component { constructor (props) { super(props); @@ -14,6 +19,7 @@ class Dropzone extends React.Component { mouseOver : false, dimPreview : false, filePreview: null, + memeify : false, }; if(props.file) { @@ -121,7 +127,7 @@ class Dropzone extends React.Component { } render () { - const { dragOver, mouseOver, dimPreview, filePreview } = this.state; + const { dragOver, mouseOver, dimPreview, filePreview, memeify } = this.state; const { file, thumbnail, fileError, isUpdate, sourceUrl, fileExt } = this.props; const hasContent = !!(file || isUpdate); @@ -147,7 +153,7 @@ class Dropzone extends React.Component { sourceUrl, }; - let memeify = file && filePreview ? ( + const memeifyContent = memeify && file && filePreview ? (
@@ -186,7 +192,12 @@ class Dropzone extends React.Component { message={fileExt === 'mp4' ? 'Drag & drop new thumbnail' : null} /> ) : null } - {memeify} + { !memeify && ( +
this.setState({ memeify: !memeify })}> + Memeify +
+ )} + {memeifyContent}
) : ( diff --git a/package.json b/package.json index 6cf18c8b..8f066fae 100644 --- a/package.json +++ b/package.json @@ -70,12 +70,14 @@ "passport-local": "^1.0.0", "prop-types": "^15.6.2", "react": "^16.4.2", - "react-feather": "^1.1.4", "react-dom": "^16.6.1", + "react-draggable": "^3.0.5", + "react-feather": "^1.1.4", "react-ga": "^2.5.3", "react-helmet": "^5.2.0", "react-redux": "^5.1.1", "react-router-dom": "^4.3.1", + "react-select": "^2.1.1", "redux": "^4.0.1", "redux-saga": "^0.16.2", "sequelize": "^4.41.1", @@ -97,9 +99,9 @@ "@babel/preset-react": "^7.0.0", "@babel/preset-stage-2": "^7.0.0", "@babel/register": "^7.0.0", + "babel-eslint": "9.0.0-beta.3", "babel-loader": "^7.1.2", "babel-plugin-module-resolver": "^3.1.1", - "babel-eslint": "9.0.0-beta.3", "builder": "^4.0.0", "chai": "^4.2.0", "chai-http": "^4.2.0", -- 2.45.2 From b879baa3c863f58a7d74d03be5daa46699d71b30 Mon Sep 17 00:00:00 2001 From: Shawn Date: Wed, 14 Nov 2018 21:24:36 -0600 Subject: [PATCH 10/16] Add toolbar base UI --- client/scss/_dropzone.scss | 20 +++++++++++++++--- client/src/components/Creatify/index.js | 28 ++++++++++++++++--------- client/src/containers/Dropzone/view.jsx | 16 +++++++------- 3 files changed, 43 insertions(+), 21 deletions(-) diff --git a/client/scss/_dropzone.scss b/client/scss/_dropzone.scss index b48bf165..3c5feb35 100644 --- a/client/scss/_dropzone.scss +++ b/client/scss/_dropzone.scss @@ -4,6 +4,7 @@ // be a flex container for children display: flex; flex-direction: column; + position: relative; } .dropzone { @@ -12,6 +13,7 @@ flex: 1 0 auto; // be a flex container for children display: flex; + padding: 1em; -webkit-flex-direction: column; flex-direction: column; justify-content: center; @@ -52,13 +54,17 @@ .dropzone-preview-image { display: block; - padding: 1em; - width: calc(100% - 2em); + width: 100%; +} + +.dropzone-preview-memeify { + margin-top: 3em; } .dropzone-memeify-button { - background: #333; + background: $primary-color; color: #fff; + cursor: pointer; font-size: .8em; padding: 3px 6px; position: absolute; @@ -67,6 +73,14 @@ z-index: 3; } +.dropzone-memeify-toolbar { + /* TODO: Cleanup `!important` */ + background: $primary-color !important; + left: -1em !important; + right: -1em !important; + top: -4em !important; +} + .dropzone-instructions-display__chooser-label { text-decoration: underline; } diff --git a/client/src/components/Creatify/index.js b/client/src/components/Creatify/index.js index c7460038..35248408 100644 --- a/client/src/components/Creatify/index.js +++ b/client/src/components/Creatify/index.js @@ -8,11 +8,10 @@ import RichDraggable from './RichDraggable'; import EditableFontface, { PRESETS as FontPresets } from './EditableFontface'; import { - faEdit, faFont, + faMinusCircle, + faPlusCircle, } from '@fortawesome/free-solid-svg-icons'; -library.add(faEdit); -library.add(faFont); const getRasterizedCanvas = (contents, width, height) => { return new Promise((resolve) => { @@ -30,10 +29,10 @@ const getRasterizedCanvas = (contents, width, height) => { } // Attempt to match font kerning with the DOM. - contents = '' + contents; + const kerningAndPadding = ''; const svgContents = ` -${contents} +${kerningAndPadding}${contents} `; const pixelRatio = 2; @@ -153,13 +152,22 @@ export default class Creatify extends Component { state, } = this; + // TODO: Abstract into separate package & use CSS Modules. + const spacerCss = { width: '.3em' }; return (
-
- {/* - - this.setFont(option.fontName)} /> +
+
+
this.renderContents()} style={{ alignItems: 'center', alignSelf: 'stretch', color: '#fff', border: '1px solid #fff', display: 'flex', padding: '.4em' }}> + Finish +
diff --git a/client/src/containers/Dropzone/view.jsx b/client/src/containers/Dropzone/view.jsx index 4814e4e7..4352a74b 100644 --- a/client/src/containers/Dropzone/view.jsx +++ b/client/src/containers/Dropzone/view.jsx @@ -154,7 +154,7 @@ class Dropzone extends React.Component { }; const memeifyContent = memeify && file && filePreview ? ( - +
@@ -168,7 +168,12 @@ class Dropzone extends React.Component { {isUpdate && fileExt === 'mp4' ? (

Video updates are currently disabled. This feature will be available soon. You can edit metadata.

) : ( -
+
+ { hasContent && !memeify && ( +
this.setState({ memeify: !memeify })}> + Memeify +
+ )}
{hasContent ? ( -
+
{ dragOver ? : null } @@ -192,11 +197,6 @@ class Dropzone extends React.Component { message={fileExt === 'mp4' ? 'Drag & drop new thumbnail' : null} /> ) : null } - { !memeify && ( -
this.setState({ memeify: !memeify })}> - Memeify -
- )} {memeifyContent}
-- 2.45.2 From 73008347ca364649aa9c6191c38b996c6dd1691f Mon Sep 17 00:00:00 2001 From: Shawn Date: Wed, 14 Nov 2018 22:17:18 -0600 Subject: [PATCH 11/16] Add dynamic elements --- .../Creatify/RichDraggable/index.js | 2 +- client/src/components/Creatify/index.js | 71 ++++++++++++++++--- 2 files changed, 61 insertions(+), 12 deletions(-) diff --git a/client/src/components/Creatify/RichDraggable/index.js b/client/src/components/Creatify/RichDraggable/index.js index a4097085..8ec02ede 100644 --- a/client/src/components/Creatify/RichDraggable/index.js +++ b/client/src/components/Creatify/RichDraggable/index.js @@ -48,7 +48,7 @@ export default class RichDraggable extends Component { }; return ( - +
{props.children} diff --git a/client/src/components/Creatify/index.js b/client/src/components/Creatify/index.js index 35248408..5715ce23 100644 --- a/client/src/components/Creatify/index.js +++ b/client/src/components/Creatify/index.js @@ -104,8 +104,10 @@ export default class Creatify extends Component { ); this.state = { + activeElement: false, bounds: {}, fontName: fontKeys[0], + elements: [], fontOptions, }; } @@ -125,7 +127,58 @@ export default class Creatify extends Component { */ } - renderContents() { + setActiveElement(activeElement) { + this.setState({ activeElement }); + } + + addElement() { + const { + state + } = this; + + const newElementKey = `element-${state.elements.length}-${Date.now()}`; + + const newElement = ( + this.setActiveElement(newElement)}> + + + ); + + this.setState({ + elements: [...state.elements, newElement], + activeElement: newElement, + }); + } + + removeElement() { + const { + state + } = this; + + const activeElementIndex = state.elements.indexOf(state.activeElement); + + if(state.elements.length === 0 || activeElementIndex === -1) { + return; + } + + const elements = [...state.elements]; + elements.splice(activeElementIndex, 1) + + this.setState({ + activeElement: false, + elements, + }); + } + + async onSave() { + const renderedCanvas = await this.renderContentsToCanvas(); + + if(this.props.onSave) { + this.props.onSave(renderedCanvas); + } + } + + async renderContentsToCanvas() { const me = this; const contentsElement = me.contents.current; @@ -140,9 +193,7 @@ export default class Creatify extends Component { // Fix the dimensions, fixes when flex is used. contents = `
${contents}
`; - getRasterizedCanvas(contents, contentsWidth, contentsHeight).then((element) => { - document.body.appendChild(element); - }); + return await getRasterizedCanvas(contents, contentsWidth, contentsHeight); } render() { @@ -157,22 +208,20 @@ export default class Creatify extends Component { return (
- + this.addElement()} />
- + this.removeElement()} />
this.setFont(option.fontName)} />
-
this.onSave()} style={{ alignItems: 'center', alignSelf: 'stretch', color: '#fff', border: '1px solid #fff', display: 'flex', padding: '0 0.6em' }}> +
this.onSave()} style={{ alignItems: 'center', alignSelf: 'stretch', border: '1px solid #fff', borderRadius: '4px', color: '#fff', display: 'flex', padding: '0 0.6em' }}> Save
diff --git a/client/src/containers/Dropzone/view.jsx b/client/src/containers/Dropzone/view.jsx index 4352a74b..db9bdc66 100644 --- a/client/src/containers/Dropzone/view.jsx +++ b/client/src/containers/Dropzone/view.jsx @@ -126,6 +126,23 @@ class Dropzone extends React.Component { } } + selectFileFromCanvas (canvas) { + const destinationFormat = 'image/jpeg'; + + canvas.toBlob((blob) => { + const file = new File([blob], 'memeify.jpg', { + type: destinationFormat, + }); + + this.props.selectFile(file); + + // TODO: Add ability to reset. + this.setState({ + memeify: false, + }); + }, destinationFormat, 0.95); + } + render () { const { dragOver, mouseOver, dimPreview, filePreview, memeify } = this.state; const { file, thumbnail, fileError, isUpdate, sourceUrl, fileExt } = this.props; @@ -154,7 +171,7 @@ class Dropzone extends React.Component { }; const memeifyContent = memeify && file && filePreview ? ( - + this.selectFileFromCanvas(canvas)}>
-- 2.45.2 From 010734629ec9a123b4a76c37044ea76fe6771dcf Mon Sep 17 00:00:00 2001 From: Shawn Date: Thu, 15 Nov 2018 02:20:07 -0600 Subject: [PATCH 13/16] Add OldBlue font --- .../Creatify/EditableFontface/index.js | 1 + .../components/Creatify/FontFaces/OldBlue.js | 36 +++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 client/src/components/Creatify/FontFaces/OldBlue.js diff --git a/client/src/components/Creatify/EditableFontface/index.js b/client/src/components/Creatify/EditableFontface/index.js index 29866c65..d2f0e18d 100644 --- a/client/src/components/Creatify/EditableFontface/index.js +++ b/client/src/components/Creatify/EditableFontface/index.js @@ -69,4 +69,5 @@ export const PRESETS = { 'Green Machine': require('../FontFaces/GreenMachine'), 'vapor wave': require('../FontFaces/VaporWave'), 'The Special': require('../FontFaces/TheSpecial'), + 'Old Blue': require('../FontFaces/OldBlue'), } diff --git a/client/src/components/Creatify/FontFaces/OldBlue.js b/client/src/components/Creatify/FontFaces/OldBlue.js new file mode 100644 index 00000000..9e7a2b61 --- /dev/null +++ b/client/src/components/Creatify/FontFaces/OldBlue.js @@ -0,0 +1,36 @@ +import React from 'react'; + +const charToFullWidth = char => { + const c = char.charCodeAt( 0 ) + return c >= 33 && c <= 126 + ? String.fromCharCode( ( c - 33 ) + 65281 ) + : char +} + +const stringToFullWidth = + +module.exports = { + container: {}, + editorStyle: {}, + text: { + fontFamily: 'Segoe UI,Helvetica,Arial', + }, + textRender: (text) => { + const id = `curve-${text.replace(/[^A-Za-z0-9]/g, '')}-oceanwave` + return ( + + + + + {text} + + + + + {text} + + + + ); + }, +}; -- 2.45.2 From dff7d8877f4fc434b4567ac463023d341be1b279 Mon Sep 17 00:00:00 2001 From: Shawn Date: Thu, 15 Nov 2018 02:24:08 -0600 Subject: [PATCH 14/16] Tweak OldBlue font --- client/src/components/Creatify/FontFaces/OldBlue.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/components/Creatify/FontFaces/OldBlue.js b/client/src/components/Creatify/FontFaces/OldBlue.js index 9e7a2b61..c84cd629 100644 --- a/client/src/components/Creatify/FontFaces/OldBlue.js +++ b/client/src/components/Creatify/FontFaces/OldBlue.js @@ -25,7 +25,7 @@ module.exports = { {text} - + {text} -- 2.45.2 From adfcbfdbeab266c73324222211abce7ed82c5082 Mon Sep 17 00:00:00 2001 From: Shawn Date: Thu, 29 Nov 2018 20:25:49 -0600 Subject: [PATCH 15/16] Add fonts (Lazer, Green Machine, Inferno), fix fiont previews, add save message --- client/scss/_dropzone.scss | 6 +++ .../Creatify/EditableFontface/index.js | 43 +++++++++++++++---- .../Creatify/FontFaces/GreenMachine.js | 6 ++- .../components/Creatify/FontFaces/Inferno.js | 22 ++++++++++ .../components/Creatify/FontFaces/Lazer.js | 27 ++++++++++++ .../components/Creatify/FontFaces/OldBlue.js | 3 ++ .../Creatify/FontFaces/VaporWave.js | 6 +++ .../Creatify/RichDraggable/index.js | 6 +-- client/src/components/Creatify/index.js | 4 +- client/src/containers/Dropzone/view.jsx | 7 +-- 10 files changed, 112 insertions(+), 18 deletions(-) create mode 100644 client/src/components/Creatify/FontFaces/Inferno.js create mode 100644 client/src/components/Creatify/FontFaces/Lazer.js diff --git a/client/scss/_dropzone.scss b/client/scss/_dropzone.scss index 3c5feb35..a3934edd 100644 --- a/client/scss/_dropzone.scss +++ b/client/scss/_dropzone.scss @@ -73,6 +73,12 @@ z-index: 3; } +.dropzone-memeify-saveMessage { + padding-top: .25em; + position: relative; + top: .5em; +} + .dropzone-memeify-toolbar { /* TODO: Cleanup `!important` */ background: $primary-color !important; diff --git a/client/src/components/Creatify/EditableFontface/index.js b/client/src/components/Creatify/EditableFontface/index.js index d2f0e18d..3c0da159 100644 --- a/client/src/components/Creatify/EditableFontface/index.js +++ b/client/src/components/Creatify/EditableFontface/index.js @@ -7,32 +7,48 @@ export default class EditableFontface extends Component { super(props); this.state = { + blinkSelection: props.blinkSelection == false ? false : true, value: props.value, }; + + this.textInput = React.createRef(); + } + + componentDidMount() { + const textInput = this.textInput.current; + + if(textInput) { + textInput.focus(); + } } render() { const me = this; const { + blinkSelection, value } = me.state; const { editable = true, fontFace, + preview, } = me.props; const textRender = fontFace.textRender || DEFAULT_TEXT_RENDER; const textStyles = Object.assign({ + ...(blinkSelection ? { + animation: 'textBlink 1s infinite', + } : {}), minHeight: '20px', WebkitFontSmoothing: 'antialiased', MozOsxFontSmoothing: 'grayscale', - }, fontFace.text); + }, fontFace.text, preview ? fontFace.previewOverrides : {}); const fontInput = (editable === true) ? ( - me.onKeyPress(e)} onChange={(e) => me.onChange(e)} style={{ + me.onKeyPress(e)} onChange={(e) => me.onChange(e)} style={{ ...{ bottom: 0, opacity: 0, @@ -49,25 +65,34 @@ export default class EditableFontface extends Component { return (
- {fontInput} -
{textRender(value)}
+ + {fontInput} +
{textRender(value)}
); } onKeyPress(e) { - this.setState({ value: e.target.value }); + this.setState({ + blinkSelection: false, + value: e.target.value + }); } onChange(e) { - this.setState({ value: e.target.value }); + this.setState({ + blinkSelection: false, + value: e.target.value + }); } }; export const PRESETS = { - 'Retro Rainbow': require('../FontFaces/RetroRainbow'), + 'Inferno': require('../FontFaces/Inferno'), 'Green Machine': require('../FontFaces/GreenMachine'), - 'vapor wave': require('../FontFaces/VaporWave'), - 'The Special': require('../FontFaces/TheSpecial'), + 'Lazer': require('../FontFaces/Lazer'), 'Old Blue': require('../FontFaces/OldBlue'), + 'Retro Rainbow': require('../FontFaces/RetroRainbow'), + 'The Special': require('../FontFaces/TheSpecial'), + 'Vapor Wave': require('../FontFaces/VaporWave'), } diff --git a/client/src/components/Creatify/FontFaces/GreenMachine.js b/client/src/components/Creatify/FontFaces/GreenMachine.js index b3163983..071a1e2c 100644 --- a/client/src/components/Creatify/FontFaces/GreenMachine.js +++ b/client/src/components/Creatify/FontFaces/GreenMachine.js @@ -1,6 +1,10 @@ module.exports = { container: {}, text: { - color: 'green', + color: '#00b700', + fontFamily: 'courier, Courier New', + fontSize: '2rem', + fontWeight: 'bold', + textShadow: '1px 1px 2px #003605', }, }; diff --git a/client/src/components/Creatify/FontFaces/Inferno.js b/client/src/components/Creatify/FontFaces/Inferno.js new file mode 100644 index 00000000..01d4d9cb --- /dev/null +++ b/client/src/components/Creatify/FontFaces/Inferno.js @@ -0,0 +1,22 @@ +module.exports = { + container: {}, + editorStyle: { + fontFamily: 'helvetica, Helvetica Nue', + fontWeight: 'bold', + fontSize: '2em', + padding: '4rem 2rem 1rem 2rem', + }, + text: { + fontFamily: 'helvetica, Helvetica Nue', + fontWeight: 'bold', + fontSize: '2em', + color: '#fff', + paddingBottom: '.25em', + padding: '4rem 2rem 1rem 2rem', + textShadow: '0px 0px 3px #c20000, 0px 0px 3px #e0f2ff, 0px 0px 5px #532761, 0px 0px 20px #670606, 0 0 10px rgba(0, 0, 0, .8), 0 0 10px #fefcc9, 5px -5px 15px #feec85, -10px -10px 20px #ffae34, 10px -20px 25px #ec760c, -10px -30px 30px #cd4606, 0 -40px 35px #973716, 5px -45px 40px #451b0e, 0 -2px 15px rgba(255, 200, 160, .5)', + }, + previewOverrides: { + fontSize: '1.5em', + padding: '0 1rem 0 1rem', + }, +}; diff --git a/client/src/components/Creatify/FontFaces/Lazer.js b/client/src/components/Creatify/FontFaces/Lazer.js new file mode 100644 index 00000000..ffd2747b --- /dev/null +++ b/client/src/components/Creatify/FontFaces/Lazer.js @@ -0,0 +1,27 @@ +module.exports = { + container: {}, + editorStyle: { + fontFamily: 'helvetica, Helvetica Nue', + fontWeight: 'bold', + fontSize: '2em', + padding: '.05rem', + textTransform: 'uppercase', + whiteSpace: 'nowrap', + }, + text: { + fontFamily: 'helvetica, Helvetica Nue', + fontWeight: 'bold', + backgroundImage: 'linear-gradient(180deg, #249bff 0%, #e1f8ff 44%, #3a006b 44%, #ff57d6 100%)', + backgroundClip: 'text', + fontSize: '2em', + color: 'transparent', + paddingBottom: '.25em', + paddingTop: '.1em', + filter: 'drop-shadow(0 0 .05rem black)', + padding: '.05rem', + textTransform: 'uppercase', + whiteSpace: 'nowrap', + WebkitBackgroundClip: 'text', + WebkitTextStroke: '0.03em rgba(255, 255, 255, 0.6)', + }, +}; diff --git a/client/src/components/Creatify/FontFaces/OldBlue.js b/client/src/components/Creatify/FontFaces/OldBlue.js index c84cd629..99448d87 100644 --- a/client/src/components/Creatify/FontFaces/OldBlue.js +++ b/client/src/components/Creatify/FontFaces/OldBlue.js @@ -15,6 +15,9 @@ module.exports = { text: { fontFamily: 'Segoe UI,Helvetica,Arial', }, + previewOverrides: { + height: '2.6rem', + }, textRender: (text) => { const id = `curve-${text.replace(/[^A-Za-z0-9]/g, '')}-oceanwave` return ( diff --git a/client/src/components/Creatify/FontFaces/VaporWave.js b/client/src/components/Creatify/FontFaces/VaporWave.js index f45f2897..7d2f0575 100644 --- a/client/src/components/Creatify/FontFaces/VaporWave.js +++ b/client/src/components/Creatify/FontFaces/VaporWave.js @@ -15,6 +15,12 @@ module.exports = { text: { fontFamily: 'Segoe UI,Helvetica,Arial', }, + previewOverrides: { + transform: 'rotate(39deg)', + height: '7rem', + paddingLeft: '2rem', + margin: '-2rem 0', + }, textRender: (text) => { const formattedText = text.toLowerCase().split('').map((char) => { const c = char.charCodeAt( 0 ) diff --git a/client/src/components/Creatify/RichDraggable/index.js b/client/src/components/Creatify/RichDraggable/index.js index 8ec02ede..8b9915c3 100644 --- a/client/src/components/Creatify/RichDraggable/index.js +++ b/client/src/components/Creatify/RichDraggable/index.js @@ -41,15 +41,15 @@ export default class RichDraggable extends Component { } = props.bounds; const bounds = { - top: 0, - left: 0, + //top: 0, + //left: 0, right: right - state.width, bottom: bottom - state.height, }; return ( -
+
{props.children}
diff --git a/client/src/components/Creatify/index.js b/client/src/components/Creatify/index.js index acae72f6..91c77c9e 100644 --- a/client/src/components/Creatify/index.js +++ b/client/src/components/Creatify/index.js @@ -95,7 +95,7 @@ export default class Creatify extends Component { value: fontName, label: (
- +
), fontName, @@ -140,7 +140,7 @@ export default class Creatify extends Component { const newElement = ( this.setActiveElement(newElement)}> - + ); diff --git a/client/src/containers/Dropzone/view.jsx b/client/src/containers/Dropzone/view.jsx index db9bdc66..f7f05a95 100644 --- a/client/src/containers/Dropzone/view.jsx +++ b/client/src/containers/Dropzone/view.jsx @@ -130,7 +130,7 @@ class Dropzone extends React.Component { const destinationFormat = 'image/jpeg'; canvas.toBlob((blob) => { - const file = new File([blob], 'memeify.jpg', { + const file = new File([blob], `memeify-${Math.random().toString(36).substring(7)}.jpg`, { type: destinationFormat, }); @@ -172,7 +172,7 @@ class Dropzone extends React.Component { const memeifyContent = memeify && file && filePreview ? ( this.selectFileFromCanvas(canvas)}> -
+
@@ -186,7 +186,7 @@ class Dropzone extends React.Component {

Video updates are currently disabled. This feature will be available soon. You can edit metadata.

) : (
- { hasContent && !memeify && ( + { hasContent && !memeify && fileExt !== 'mp4' && (
this.setState({ memeify: !memeify })}> Memeify
@@ -222,6 +222,7 @@ class Dropzone extends React.Component { ) )} + {memeifyContent ?
{`Don't forget to save before you publish.`}
: null}
)} -- 2.45.2 From 7b53cf48ec510b23b5fc753eac7315bd5fc454c5 Mon Sep 17 00:00:00 2001 From: Shawn Date: Thu, 29 Nov 2018 20:54:24 -0600 Subject: [PATCH 16/16] Font tweaks and add Neon font --- .../Creatify/EditableFontface/index.js | 3 ++- .../Creatify/FontFaces/GreenMachine.js | 5 +++++ .../components/Creatify/FontFaces/Inferno.js | 3 --- .../components/Creatify/FontFaces/Lazer.js | 4 ---- .../src/components/Creatify/FontFaces/Neon.js | 21 +++++++++++++++++++ .../Creatify/RichDraggable/index.js | 2 +- 6 files changed, 29 insertions(+), 9 deletions(-) create mode 100644 client/src/components/Creatify/FontFaces/Neon.js diff --git a/client/src/components/Creatify/EditableFontface/index.js b/client/src/components/Creatify/EditableFontface/index.js index 3c0da159..2ef131e0 100644 --- a/client/src/components/Creatify/EditableFontface/index.js +++ b/client/src/components/Creatify/EditableFontface/index.js @@ -88,9 +88,10 @@ export default class EditableFontface extends Component { }; export const PRESETS = { - 'Inferno': require('../FontFaces/Inferno'), 'Green Machine': require('../FontFaces/GreenMachine'), + 'Inferno': require('../FontFaces/Inferno'), 'Lazer': require('../FontFaces/Lazer'), + 'Neon': require('../FontFaces/Neon'), 'Old Blue': require('../FontFaces/OldBlue'), 'Retro Rainbow': require('../FontFaces/RetroRainbow'), 'The Special': require('../FontFaces/TheSpecial'), diff --git a/client/src/components/Creatify/FontFaces/GreenMachine.js b/client/src/components/Creatify/FontFaces/GreenMachine.js index 071a1e2c..60b0b462 100644 --- a/client/src/components/Creatify/FontFaces/GreenMachine.js +++ b/client/src/components/Creatify/FontFaces/GreenMachine.js @@ -1,5 +1,10 @@ module.exports = { container: {}, + editorStyle: { + fontFamily: 'courier, Courier New', + fontWeight: 'bold', + fontSize: '2em', + }, text: { color: '#00b700', fontFamily: 'courier, Courier New', diff --git a/client/src/components/Creatify/FontFaces/Inferno.js b/client/src/components/Creatify/FontFaces/Inferno.js index 01d4d9cb..45fc4b20 100644 --- a/client/src/components/Creatify/FontFaces/Inferno.js +++ b/client/src/components/Creatify/FontFaces/Inferno.js @@ -4,15 +4,12 @@ module.exports = { fontFamily: 'helvetica, Helvetica Nue', fontWeight: 'bold', fontSize: '2em', - padding: '4rem 2rem 1rem 2rem', }, text: { fontFamily: 'helvetica, Helvetica Nue', fontWeight: 'bold', fontSize: '2em', color: '#fff', - paddingBottom: '.25em', - padding: '4rem 2rem 1rem 2rem', textShadow: '0px 0px 3px #c20000, 0px 0px 3px #e0f2ff, 0px 0px 5px #532761, 0px 0px 20px #670606, 0 0 10px rgba(0, 0, 0, .8), 0 0 10px #fefcc9, 5px -5px 15px #feec85, -10px -10px 20px #ffae34, 10px -20px 25px #ec760c, -10px -30px 30px #cd4606, 0 -40px 35px #973716, 5px -45px 40px #451b0e, 0 -2px 15px rgba(255, 200, 160, .5)', }, previewOverrides: { diff --git a/client/src/components/Creatify/FontFaces/Lazer.js b/client/src/components/Creatify/FontFaces/Lazer.js index ffd2747b..96373b4c 100644 --- a/client/src/components/Creatify/FontFaces/Lazer.js +++ b/client/src/components/Creatify/FontFaces/Lazer.js @@ -4,7 +4,6 @@ module.exports = { fontFamily: 'helvetica, Helvetica Nue', fontWeight: 'bold', fontSize: '2em', - padding: '.05rem', textTransform: 'uppercase', whiteSpace: 'nowrap', }, @@ -15,10 +14,7 @@ module.exports = { backgroundClip: 'text', fontSize: '2em', color: 'transparent', - paddingBottom: '.25em', - paddingTop: '.1em', filter: 'drop-shadow(0 0 .05rem black)', - padding: '.05rem', textTransform: 'uppercase', whiteSpace: 'nowrap', WebkitBackgroundClip: 'text', diff --git a/client/src/components/Creatify/FontFaces/Neon.js b/client/src/components/Creatify/FontFaces/Neon.js new file mode 100644 index 00000000..16d0eb20 --- /dev/null +++ b/client/src/components/Creatify/FontFaces/Neon.js @@ -0,0 +1,21 @@ +module.exports = { + container: {}, + editorStyle: { + fontFamily: 'Helvetica, Arial', + fontWeight: 'bold', + fontSize: '2em', + letterSpacing: '.1em', + }, + text: { + color: '#fff', + fontFamily: 'Helvetica, Arial', + fontSize: '2rem', + fontWeight: 'bold', + letterSpacing: '.1em', + textShadow: '0 0 0.05em #fff, 0 0 0.1em #fff, 0 0 0.2em #fff, 0 0 .2em #ff1de2, 0 0 .4em #ff26e3, 0 0 .5em #ff00de, 0 0 1em #ff61eb, 0 0 1.5em #ff7cee', + }, + previewOverrides: { + fontSize: '1.8em', + padding: '0 1rem 0 1rem', + }, +}; diff --git a/client/src/components/Creatify/RichDraggable/index.js b/client/src/components/Creatify/RichDraggable/index.js index 8b9915c3..c0e9e462 100644 --- a/client/src/components/Creatify/RichDraggable/index.js +++ b/client/src/components/Creatify/RichDraggable/index.js @@ -50,7 +50,7 @@ export default class RichDraggable extends Component { return (
-
+
{props.children}
-- 2.45.2