Skip to content

Commit

Permalink
Add toggles for showLandingPage and onlyLandingPage
Browse files Browse the repository at this point in the history
  • Loading branch information
tiberiuichim committed Dec 2, 2022
1 parent 7c0d3ce commit 8bf0d00
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 8 deletions.
23 changes: 17 additions & 6 deletions searchlib/components/Layout/TopFilterLayout.jsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
import React from 'react';
import { useAtom } from 'jotai';
import { Grid, Dimmer, Loader } from 'semantic-ui-react';

import { isLandingPageAtom } from '@eeacms/search/state';
import { useAtom } from 'jotai';
import { useSearchContext } from '@eeacms/search/lib/hocs';

const TopFilterLayout = (props) => {
const { bodyContent, bodyFooter, bodyHeader, header, sideContent } = props;
const {
bodyContent,
bodyFooter,
bodyHeader,
header,
sideContent,
appConfig,
} = props;
const { onlyLandingPage = false } = appConfig;
const [isLandingPage] = useAtom(isLandingPageAtom);
const searchContext = useSearchContext();

Expand All @@ -17,11 +26,13 @@ const TopFilterLayout = (props) => {
</Dimmer>
)}

<div className="search-header-container">
<div className="sui-layout-header">
<div className="sui-layout-header__inner">{header}</div>
{!onlyLandingPage && (
<div className="search-header-container">
<div className="sui-layout-header">
<div className="sui-layout-header__inner">{header}</div>
</div>
</div>
</div>
)}

<div className="body-content">
{!isLandingPage && <>{sideContent}</>}
Expand Down
4 changes: 3 additions & 1 deletion searchlib/registry.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,6 @@ const config = {
title: 'Search catalogue', // the main search app headline
headline: '', // main headline
subheadline: '', // text under the headline
searchInputPlaceholder: '', // search input placeholder
demoquestion: '', // Question used as example under the search input
// debug: true,
hasA11yNotifications: true,
Expand All @@ -264,6 +263,9 @@ const config = {
// when entering in search view, this will be the default search text
defaultSearchText: '',

showLandingPage: true,
onlyLandingPage: false,

// Custom placeholder text for search input
searchInputPlaceholder: '',

Expand Down
22 changes: 21 additions & 1 deletion src/SearchBlock/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,14 @@ export const SearchBlockSchema = ({ formData = {} }) => ({
{
id: 'default',
title: 'Default',
fields: ['appName', 'headline', 'subheadline', 'searchInputPlaceholder'],
fields: [
'appName',
'headline',
'subheadline',
'searchInputPlaceholder',
'showLandingPage',
...(formData?.showLandingPage ? ['onlyLandingPage'] : []),
],
},
{
id: 'general',
Expand Down Expand Up @@ -46,6 +53,19 @@ export const SearchBlockSchema = ({ formData = {} }) => ({
choices: [],
},

showLandingPage: {
title: 'Show landing page',
type: 'boolean',
configPath: 'showLandingPage',
default: true,
},
onlyLandingPage: {
title: 'Only landing page?',
type: 'boolean',
configPath: 'onlyLandingPage',
default: false,
},

enableNLP: {
type: 'boolean',
title: 'Enable NLP capabilities?',
Expand Down

0 comments on commit 8bf0d00

Please sign in to comment.