0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-15 17:02:38 +00:00

Theme switches on click

This commit is contained in:
Trevor Buckner
2022-01-09 23:19:03 -05:00
parent 87bb682836
commit 94157ec4d4
2 changed files with 13 additions and 6 deletions

View File

@@ -21,7 +21,8 @@ const MetadataEditor = createClass({
published : false, published : false,
authors : [], authors : [],
systems : [], systems : [],
renderer : 'legacy' renderer : 'legacy',
theme : '5ePHB'
}, },
onChange : ()=>{} onChange : ()=>{}
}; };
@@ -52,6 +53,12 @@ const MetadataEditor = createClass({
})); }));
}, },
handleTheme : function(theme){
this.props.metadata.renderer = theme.renderer;
this.props.metadata.theme = theme.name;
this.props.onChange(this.props.metadata);
},
handleDelete : function(){ handleDelete : function(){
if(this.props.metadata.authors && this.props.metadata.authors.length <= 1){ if(this.props.metadata.authors && this.props.metadata.authors.length <= 1){
if(!confirm('Are you sure you want to delete this brew? Because you are the only owner of this brew, the document will be deleted permanently.')) return; if(!confirm('Are you sure you want to delete this brew? Because you are the only owner of this brew, the document will be deleted permanently.')) return;
@@ -121,7 +128,7 @@ const MetadataEditor = createClass({
renderThemeDropdown : function(){ renderThemeDropdown : function(){
const listThemes = (renderer)=>{ const listThemes = (renderer)=>{
return _.map(Themes[renderer], (theme)=>{ return _.map(Themes[renderer], (theme)=>{
return <div href={''} className='item' key={''} target='_blank' rel='noopener noreferrer' title={''}> return <div href={''} className='item' key={''} onClick={()=>this.handleTheme(theme)} title={''}>
{`${theme.renderer} : ${theme.name}`} {`${theme.renderer} : ${theme.name}`}
</div>; </div>;
}); });
@@ -131,7 +138,7 @@ const MetadataEditor = createClass({
<label>theme</label> <label>theme</label>
<Nav.dropdown trigger='click'> <Nav.dropdown trigger='click'>
<div> <div>
share <i class='fas fa-caret-down'></i> {`${this.props.metadata.renderer} : ${this.props.metadata.theme}`} <i className='fas fa-caret-down'></i>
</div> </div>
{listThemes('Legacy')} {listThemes('Legacy')}
{listThemes('V3')} {listThemes('V3')}

View File

@@ -93,7 +93,7 @@
} }
&>div:first-child { &>div:first-child {
border : 2px solid rgb(118,118,118); border : 2px solid rgb(118,118,118);
padding : 6px 2px; padding : 6px 3px;
background-color : inherit; background-color : inherit;
i { i {
float: right; float: right;
@@ -101,8 +101,8 @@
} }
.navDropdown { .navDropdown {
box-shadow: 0px 5px 10px rgba(0, 0, 0, 0.3); box-shadow: 0px 5px 10px rgba(0, 0, 0, 0.3);
* { .item {
padding: 3px 2px; padding: 3px 3px;
border-top: 1px solid rgb(118, 118, 118); border-top: 1px solid rgb(118, 118, 118);
&:hover { &:hover {
background-color: @blue; background-color: @blue;