0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-30 02:22:49 +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,
authors : [],
systems : [],
renderer : 'legacy'
renderer : 'legacy',
theme : '5ePHB'
},
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(){
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;
@@ -121,7 +128,7 @@ const MetadataEditor = createClass({
renderThemeDropdown : function(){
const listThemes = (renderer)=>{
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}`}
</div>;
});
@@ -131,7 +138,7 @@ const MetadataEditor = createClass({
<label>theme</label>
<Nav.dropdown trigger='click'>
<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>
{listThemes('Legacy')}
{listThemes('V3')}

View File

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