generated from eea/volto-frontend-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.
Merge pull request #24 from eea/develop
Develop
- Loading branch information
Showing
12 changed files
with
233 additions
and
79 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
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,21 @@ | ||
import React from 'react'; | ||
import { Card as UiCard } from 'semantic-ui-react'; | ||
|
||
const CardOrganization = (props) => { | ||
const { item, itemModel = {}, description } = props; | ||
const { Description, organization } = item; | ||
const { hasDescription } = itemModel; | ||
const desc = description || Description; | ||
const show = hasDescription && desc; | ||
|
||
return show ? ( | ||
<> | ||
{' '} | ||
<UiCard.Description content={`(${desc})`} /> | ||
{' '} | ||
<UiCard.Description content={organization} /> | ||
</> | ||
) : null; | ||
}; | ||
|
||
export default CardOrganization; |
70 changes: 70 additions & 0 deletions
70
...ustomizations/@eeacms/volto-listing-block/blocks/Listing/item-templates/CardTemplates.jsx
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,70 @@ | ||
import cx from 'classnames'; | ||
|
||
import { Card as UiCard } from 'semantic-ui-react'; | ||
|
||
import { | ||
CardTitle, | ||
CardMeta, | ||
CardExtra, | ||
CardImage, | ||
} from '@eeacms/volto-listing-block/components/UniversalCard'; | ||
import CardOrganization from '../../../../../../components/CardOrganization'; | ||
|
||
const getStyles = (props) => { | ||
const { itemModel = {} } = props; | ||
const res = {}; | ||
if (itemModel.maxDescription) { | ||
res[`max-${itemModel.maxDescription}-lines`] = true; | ||
} | ||
if (itemModel.maxTitle) { | ||
res[`title-max-${itemModel.maxTitle}-lines`] = true; | ||
} | ||
return res; | ||
}; | ||
|
||
const BasicCard = (props) => { | ||
const { className } = props; | ||
|
||
return ( | ||
<UiCard fluid={true} className={cx('u-card', getStyles(props), className)}> | ||
<CardImage {...props} /> | ||
<UiCard.Content> | ||
<CardMeta {...props} /> | ||
<CardTitle {...props} /> | ||
<CardOrganization {...props}/> | ||
</UiCard.Content> | ||
<CardExtra {...props} /> | ||
</UiCard> | ||
); | ||
}; | ||
|
||
export const DefaultCardLayout = BasicCard; | ||
|
||
export const LeftImageCardLayout = (props) => ( | ||
<BasicCard | ||
{...props} | ||
className={cx(props.className || 'left-image-card', '')} | ||
/> | ||
); | ||
|
||
export const RightImageCardLayout = (props) => ( | ||
<BasicCard | ||
{...props} | ||
className={cx(props.className || 'right-image-card', '')} | ||
/> | ||
); | ||
|
||
export const ImageCardLayout = (props) => { | ||
const { className } = props; | ||
|
||
return ( | ||
<UiCard | ||
fluid={true} | ||
className={cx('u-card', getStyles(props), { | ||
[className]: className, | ||
})} | ||
> | ||
<CardImage {...props} /> | ||
</UiCard> | ||
); | ||
}; |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.