From 7499a0d9abbdd850c77661de4a9d3ec16c8e4b45 Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Fri, 29 Oct 2021 11:54:56 +1300 Subject: [PATCH] Add thumbnail preview to Metadata Editor --- .../editor/metadataEditor/metadataEditor.jsx | 41 +++++++++++++++---- .../editor/metadataEditor/metadataEditor.less | 27 +++++++++++- 2 files changed, 57 insertions(+), 11 deletions(-) diff --git a/client/homebrew/editor/metadataEditor/metadataEditor.jsx b/client/homebrew/editor/metadataEditor/metadataEditor.jsx index b4607b153..40cb5c111 100644 --- a/client/homebrew/editor/metadataEditor/metadataEditor.jsx +++ b/client/homebrew/editor/metadataEditor/metadataEditor.jsx @@ -11,20 +11,27 @@ const MetadataEditor = createClass({ getDefaultProps : function() { return { metadata : { - editId : null, - title : '', - description : '', - tags : '', - published : false, - authors : [], - systems : [], - renderer : 'legacy', - thumbnail : '' + editId : null, + title : '', + description : '', + tags : '', + published : false, + authors : [], + systems : [], + renderer : 'legacy', + thumbnail : '', + showThumbnail : false }, onChange : ()=>{} }; }, + getInitialState : function(){ + return { + showThumbnail : false + }; + }, + handleFieldChange : function(name, e){ this.props.onChange(_.merge({}, this.props.metadata, { [name] : e.target.value @@ -66,6 +73,17 @@ const MetadataEditor = createClass({ }); }, + toggleThumbnailDisplay : function(){ + this.setState({ + showThumbnail : !this.state.showThumbnail + }); + }, + + renderThumbnail : function(){ + if(!this.state.showThumbnail) return; + return ; + }, + renderSystems : function(){ return _.map(SYSTEMS, (val)=>{ return