generated from eea/volto-addon-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7bdbd31
commit a7f5a0d
Showing
3 changed files
with
20 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,18 @@ | ||
import React from 'react'; | ||
/** | ||
* This is a big "switch" | ||
*/ | ||
// import React from 'react'; | ||
|
||
import { SEARCH_STATES } from '@eeacms/search/constants'; | ||
import { SEARCH_STATE_IDS } from '@eeacms/search/constants'; | ||
|
||
export default function RenderSlot(props) { | ||
const { slotName, searchState } = props; | ||
return props[slotName] ? props[slotName] : null; | ||
const anyStateId = `${slotName}-${SEARCH_STATE_IDS.any}`; | ||
const byStateId = `${slotName}-${SEARCH_STATE_IDS[searchState]}`; | ||
|
||
const anyState = props[anyStateId]; | ||
const byState = props[byStateId]; | ||
|
||
const res = props[slotName] || byState || anyState || null; | ||
return res; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters