/
index.jsx
53 lines (46 loc) · 1.33 KB
/
index.jsx
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import React from "react";
import { tagTypes } from "../../../../data/rulesmarketplace";
import styles from "./styles.module.css";
// const TagComp = React.forwardRef<HTMLLIElement>(
// ({label, color, description}, ref) => (
// <li ref={ref} className={styles.tag} title={description}>
// <span className={styles.textLabel}>{label.toLowerCase()}</span>
// <span className={styles.colorLabel} style={{backgroundColor: color}} />
// </li>
// ),
// );
function MarketplaceCardTag(input) {
const tag = input.tag;
function getColorForTag(tag) {
if (tag in tagTypes) {
return tagTypes[tag].color;
} else {
return null;
}
}
function getDescriptionForTag(tag) {
if (tag in tagTypes) {
return tagTypes[tag].description;
} else {
return null;
}
}
return (
<li title={getDescriptionForTag(tag)} className={styles.tag}>
<span className={styles.textLabel}>{input.tag.toLowerCase()}</span>
<span
className={styles.colorLabel}
style={{ backgroundColor: getColorForTag(tag) }}
/>
</li>
// <Tooltip
// key={index}
// text={tagObject.description}
// anchorEl="#__docusaurus"
// id={id}
// >
// <TagComp key={index} {...tagObject} />
// </Tooltip>
);
}
export default React.memo(MarketplaceCardTag);