Skip to content

Commit

Permalink
Add overlay in edit mode
Browse files Browse the repository at this point in the history
  • Loading branch information
tiberiuichim committed Feb 2, 2022
1 parent dcfe08c commit f33badc
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/SearchBlock/SearchBlockView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@ const applyBlockSettings = (config, appName, data, schema) => {
return config;
};

const overlayStyle = {
position: 'absolute',
width: '100%',
height: '100%',
zIndex: '100',
};

export default function SearchBlockView(props) {
const { data = {}, mode = 'view' } = props;
const schema = SearchBlockSchema(props);
Expand All @@ -75,6 +82,11 @@ export default function SearchBlockView(props) {
return (
<BodyClass className="searchlib-page">
<div className="searchlib-block">
{mode !== 'view' ? (
<div className="overlay" style={overlayStyle}></div>
) : (
''
)}
<SearchApp registry={registry} appName={appName} mode={mode} />
</div>
</BodyClass>
Expand Down
29 changes: 29 additions & 0 deletions src/SearchBlock/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ export const SearchBlockSchema = ({ formData = {} }) => ({
'subheadline',
'promptQueries',
'promptQueryInterval',
'debugQuery',
'extraQueryConfig',
'enableNLP',
],
},
Expand Down Expand Up @@ -51,6 +53,33 @@ export const SearchBlockSchema = ({ formData = {} }) => ({
configPath: 'enableNLP',
},

extraQueryConfig: {
widget: 'textarea',
title: 'Extra query configuration',
description:
'Enter a valid JSON object. It will be added to the query and it can overwrite existing query fields',
default: '{}',

modifyConfig: (config, data) => {
let extra = {};
try {
extra = JSON.parse(data);
} catch {
// eslint-disable-next-line
console.log('Not a valid JSON object', data);
return config;
} finally {
return { ...config, extra };
}
},
},

debugQuery: {
type: 'boolean',
title: 'Enable debugging?',
configPath: 'debugQuery',
},

headline: {
title: 'Main headline',
configPath: 'title',
Expand Down

0 comments on commit f33badc

Please sign in to comment.