Skip to content

Commit

Permalink
Styling update
Browse files Browse the repository at this point in the history
  • Loading branch information
tiberiuichim committed Sep 17, 2021
1 parent 262e5a9 commit 36a0eb5
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 6 deletions.
3 changes: 3 additions & 0 deletions src/SearchBlock/SearchBlockView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ import React from 'react';
import config from '@plone/volto/registry';
import { SearchApp } from '@eeacms/search';

import '@elastic/react-search-ui-views/lib/styles/styles.css';
import './styles.less';

export default function SearchBlockView({ data = {} }) {
const { appName = 'default' } = data;
const registry = config.settings.searchlib;
Expand Down
6 changes: 6 additions & 0 deletions src/SearchBlock/styles.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
@import (multiple, reference, optional) '../../theme.config';

@type: extra;
@element: custom;

@import (multiple) '~@eeacms/search-less/theme.less';
33 changes: 33 additions & 0 deletions src/components/Layout/LeftColumnLayout.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import React from 'react';

import { Grid, Container } from 'semantic-ui-react';

const LeftColumnLayout = (props) => {
const { bodyContent, bodyFooter, bodyHeader, header, sideContent } = props;
return (
<div>
<Container>
<div className="sui-layout-header">
<div className="sui-layout-header__inner">{header}</div>
</div>
</Container>

<Grid columns={2} container stackable className="body-content">
<Grid.Row>
<Grid.Column widescreen="4">
<div>{sideContent}</div>
</Grid.Column>
<Grid.Column widescreen="8">
<div>{bodyHeader}</div>
<div>{bodyContent}</div>
</Grid.Column>
</Grid.Row>
</Grid>
<Grid container className="body-footer">
<div>{bodyFooter}</div>
</Grid>
</div>
);
};

export default LeftColumnLayout;
4 changes: 4 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { registry } from '@eeacms/search';
import codeSVG from '@plone/volto/icons/code.svg';
import SearchBlockView from './SearchBlock/SearchBlockView';
import SearchBlockEdit from './SearchBlock/SearchBlockEdit';
import LeftColumnLayout from './components/Layout/LeftColumnLayout';

const applyConfig = (config) => {
config.settings.searchlib = registry;
Expand Down Expand Up @@ -53,8 +54,11 @@ const applyConfig = (config) => {
export const installGlobalSearch = (config) => {
// config.settings.devProxyToApiPath = false;
config.settings.searchlib = installConfig(config.settings.searchlib);
config.settings.searchlib.resolve.LeftColumnLayout.component = LeftColumnLayout;
config.settings.searchlib.searchui.globalsearch.elastic_index =
'_es/globalsearch';
config.settings.searchlib.searchui.globalsearch.layoutComponent =
'LeftColumnLayout';
return config;
};

Expand Down
13 changes: 7 additions & 6 deletions src/middleware/elasticsearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const handleSearch = (req, res, next, { appName, urlQA, urlES }) => {
.end((err, resp) => {
// eslint-disable-next-line
console.log(err, resp);
res.send(resp.body);
if (resp && resp.body) res.send(resp.body);
});
} else {
const url = `${urlES}/_search`;
Expand All @@ -49,15 +49,15 @@ const handleSearch = (req, res, next, { appName, urlQA, urlES }) => {
.send(body)
.set('accept', 'application/json')
.end((err, resp) => {
res.send(resp.body);
if (resp && resp.body) res.send(resp.body);
});
}
};

const handleSettings = (req, res, next, { appName, urlQA, urlES }) => {
const url = `${urlES}/_settings`;
superagent.get(url).end((err, resp) => {
res.send(resp.body);
if (resp && resp.body) res.send(resp.body);
});
};

Expand All @@ -76,7 +76,7 @@ export const createHandler = ({ urlQA, urlES }) => {
.find((b) => b);

if (appName) {
// console.log('handle search', req.path, urlQA, urlES);
console.log('handle search', req.path, urlQA, urlES);
handleSearch(req, res, next, { appName, urlQA, urlES });
return;
}
Expand All @@ -86,7 +86,7 @@ export const createHandler = ({ urlQA, urlES }) => {
.find((b) => b);

if (appName) {
// console.log('handle settings', req.path, urlQA, urlES);
console.log('handle settings', req.path, urlQA, urlES);
handleSettings(req, res, next, { appName, urlQA, urlES });
return;
}
Expand All @@ -96,11 +96,12 @@ export const createHandler = ({ urlQA, urlES }) => {
.find((b) => b);

if (appName) {
// console.log('handle download', req.path, urlQA, urlES);
console.log('handle download', req.path, urlQA, urlES);
handleDownload(req, res, next, { appName, urlQA, urlES });
return;
}

console.log('next', req.path);
next();
};
};

0 comments on commit 36a0eb5

Please sign in to comment.