forked from vtex-apps/store-components
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
36 lines (30 loc) · 1.05 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import React from 'react'
import PropTypes from 'prop-types'
import { CollectionBadgeItem } from './components/CollectionBadgeItem'
import styles from './styles.css'
/**
* Collection Badges component.
* Encapsulates and displays a responsive list of Collection Badges.
*/
const CollectionBadges = ({ collectionBadgesText, children }) => (
<div className={`${styles.collectionContainer} relative dib w-100`}>
{children}
<div className="inline-flex justify-end absolute w-100 bottom-0 left-0">
{collectionBadgesText.map((collectionBadgeText, index) => (
<CollectionBadgeItem key={collectionBadgeText + index}>
{collectionBadgeText}
</CollectionBadgeItem>
))}
</div>
</div>
)
CollectionBadges.propTypes = {
/** Array of collection badges text */
collectionBadgesText: PropTypes.array.isRequired,
/** Children component that should be render inside the collection badge item */
children: PropTypes.node.isRequired,
}
CollectionBadges.defaultProps = {
collectionBadgesText: [],
}
export default CollectionBadges