generated from eea/volto-addon-template
-
Notifications
You must be signed in to change notification settings - Fork 2
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
Showing
4 changed files
with
84 additions
and
7 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
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 |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import cx from 'classnames'; | ||
import PreviewImage from '@eeacms/volto-listing-block/PreviewImage'; | ||
|
||
const BodyText = ({ item, hasDescription }) => { | ||
return ( | ||
<div className="listing-body"> | ||
<h3 className={'listing-header'}>{item.title ? item.title : item.id}</h3> | ||
{hasDescription && ( | ||
<p className={'listing-description'}>{item.description}</p> | ||
)} | ||
</div> | ||
); | ||
}; | ||
|
||
const getStyles = (props) => { | ||
const { itemModel = {} } = props; | ||
const res = {}; | ||
if (itemModel.maxDescription) { | ||
res[`max-${itemModel.maxDescription}-lines`] = true; | ||
} | ||
return res; | ||
}; | ||
|
||
const BasicItem = (props) => { | ||
const { item, styles, className, itemModel = {} } = props; | ||
const { hasImage, hasDate, hasDescription } = itemModel; | ||
|
||
return ( | ||
<div | ||
className={cx( | ||
'u-item listing-item result-item', | ||
styles?.theme, | ||
getStyles(props), | ||
className, | ||
)} | ||
> | ||
<div className="wrapper"> | ||
<div className="slot-head">{item?.meta}</div> | ||
<div className="slot-top"> | ||
<BodyText | ||
item={item} | ||
hasDescription={hasDescription} | ||
hasDate={hasDate} | ||
/> | ||
{hasImage && ( | ||
<PreviewImage | ||
item={item} | ||
style={{ marginLeft: 'auto' }} | ||
preview_image_url={item.preview_image_url} | ||
/> | ||
)} | ||
</div> | ||
<div className="slot-bottom">{item?.extra}</div> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export const SearchItemLayout = (props) => { | ||
return <BasicItem {...props} />; | ||
}; |
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