feat: hot reload support for some widgets, css improvements on marketplace

Co-authored-by: Alex Sparkes <turbomarshmello@gmail.com>
This commit is contained in:
David Ralph
2021-04-12 18:55:02 +01:00
parent fbe6e040ea
commit b370de9ea3
17 changed files with 147 additions and 25 deletions

View File

@@ -1,5 +1,7 @@
import React from 'react';
import EventBus from '../../../modules/helpers/eventbus';
import SearchIcon from '@material-ui/icons/Search';
import MicIcon from '@material-ui/icons/Mic';
@@ -40,7 +42,7 @@ export default class Search extends React.PureComponent {
window.location.href = this.state.url + `?${this.state.query}=` + value;
}
componentDidMount() {
init() {
let url;
let query = 'q';
let microphone = null;
@@ -70,6 +72,27 @@ export default class Search extends React.PureComponent {
});
}
componentDidMount() {
EventBus.on('refresh', (data) => {
if (data === 'search') {
const element = document.querySelector('.searchBar');
if (localStorage.getItem('searchBar') === 'false') {
return element.style.display = 'none';
}
element.style.display = 'block';
this.init();
}
});
this.init();
}
componentWillUnmount() {
EventBus.remove('refresh');
}
render() {
return (
<form action={this.state.url} className='searchBar'>