0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-08 09:42:43 +00:00

Fully disable theme selection when in Legacy mode

Making Legacy a "theme" implies we will add more themes to Legacy, which we aren't planning to.
This commit is contained in:
Trevor Buckner
2022-03-01 00:34:19 -05:00
parent da5ce35c3c
commit 8e0629062d
3 changed files with 29 additions and 10 deletions

View File

@@ -144,16 +144,29 @@ const MetadataEditor = createClass({
}; };
const currentTheme = this.getThemeData(this.props.metadata.renderer, this.props.metadata.theme); const currentTheme = this.getThemeData(this.props.metadata.renderer, this.props.metadata.theme);
let dropdown;
if(this.props.metadata.renderer == 'legacy') {
dropdown =
<Nav.dropdown className='disabled' trigger='disabled'>
<div>
{`Themes are not suppdorted in the Legacy Renderer`} <i className='fas fa-caret-down'></i>
</div>
</Nav.dropdown>;
} else {
dropdown =
<Nav.dropdown trigger='click'>
<div>
{`${_.upperFirst(currentTheme.renderer)} : ${currentTheme.name}`} <i className='fas fa-caret-down'></i>
</div>
{/*listThemes('Legacy')*/}
{listThemes('V3')}
</Nav.dropdown>;
}
return <div className='field themes'> return <div className='field themes'>
<label>theme</label> <label>theme</label>
<Nav.dropdown trigger='click'> {dropdown}
<div>
{`${_.upperFirst(currentTheme.renderer)} : ${currentTheme.name}`} <i className='fas fa-caret-down'></i>
</div>
{listThemes('Legacy')}
{listThemes('V3')}
</Nav.dropdown>
</div>; </div>;
}, },

View File

@@ -86,11 +86,16 @@
font-size: 13.33px; font-size: 13.33px;
.navDropdownContainer { .navDropdownContainer {
background-color: white; background-color: white;
width: 100%; width: 100%;
&:hover { &:hover {
background-color: rgb(187, 187, 187); background-color: rgb(187, 187, 187);
} }
&.disabled {
font-style:italic;
font-style: italic;
background-color: darkgray;
color: dimgray;
}
&>div:first-child { &>div:first-child {
border : 2px solid rgb(118,118,118); border : 2px solid rgb(118,118,118);
padding : 6px 3px; padding : 6px 3px;

View File

@@ -98,17 +98,18 @@ const Nav = {
); );
}, },
render : function () { render : function () {
console.log(this.props.children);
const dropdownChildren = React.Children.map(this.props.children, (child, i)=>{ const dropdownChildren = React.Children.map(this.props.children, (child, i)=>{
// Ignore the first child // Ignore the first child
if(i < 1) return; if(i < 1) return;
return child; return child;
}); });
return ( return (
<div className='navDropdownContainer' <div className={`navDropdownContainer ${this.props.className}`}
onMouseEnter={this.props.trigger == 'hover' ? ()=>{this.handleDropdown(true);} : undefined} onMouseEnter={this.props.trigger == 'hover' ? ()=>{this.handleDropdown(true);} : undefined}
onClick= {this.props.trigger == 'click' ? ()=>{this.handleDropdown(true);} : undefined} onClick= {this.props.trigger == 'click' ? ()=>{this.handleDropdown(true);} : undefined}
onMouseLeave={()=>this.handleDropdown(false)}> onMouseLeave={()=>this.handleDropdown(false)}>
{this.props.children[0]} {this.props.children[0] || this.props.children} //children is not an array when only one child
{this.renderDropdown(dropdownChildren)} {this.renderDropdown(dropdownChildren)}
</div> </div>
); );