|
1 |
| -import { Checkbox, Grid } from 'decentraland-ui' |
| 1 | +import classNames from 'classnames' |
| 2 | +import { MappingType } from '@dcl/schemas' |
| 3 | +import { Checkbox, Grid, InfoTooltip } from 'decentraland-ui' |
| 4 | +import allIcon from '../../../icons/all.svg' |
| 5 | +import multipleIcon from '../../../icons/multiple.svg' |
| 6 | +import singleIcon from '../../../icons/single.svg' |
| 7 | +import rangeIcon from '../../../icons/range.svg' |
| 8 | +import lightbulbIcon from '../../../icons/lightbulb.svg' |
2 | 9 | import { Props } from './CollectionItemHeaderV2.types'
|
3 | 10 | import { t } from 'decentraland-dapps/dist/modules/translation'
|
| 11 | +import styles from './CollectionItemHeaderV2.module.css' |
| 12 | + |
| 13 | +const mappingTypeIcons = { |
| 14 | + [MappingType.ANY]: allIcon, |
| 15 | + [MappingType.MULTIPLE]: multipleIcon, |
| 16 | + [MappingType.SINGLE]: singleIcon, |
| 17 | + [MappingType.RANGE]: rangeIcon |
| 18 | +} |
| 19 | + |
| 20 | +const LinkingTooltipMappingType = ({ type }: { type: MappingType }) => { |
| 21 | + return ( |
| 22 | + <> |
| 23 | + <div className={styles.gridItem}> |
| 24 | + <div className={styles.mappingType}> |
| 25 | + <img className={styles.mappingIcon} src={mappingTypeIcons[type]} /> |
| 26 | + {t(`mapping_editor.mapping_types.${type}`)} |
| 27 | + </div> |
| 28 | + </div> |
| 29 | + <div className={classNames(styles.gridItem, styles.mappingDescription)}> |
| 30 | + <div>{t(`mapping_editor.mapping_descriptions.${type}`)}</div> |
| 31 | + {type !== MappingType.ANY && <div className={styles.mappingExample}>{t(`mapping_editor.mapping_examples.${type}`)}</div>} |
| 32 | + </div> |
| 33 | + </> |
| 34 | + ) |
| 35 | +} |
| 36 | + |
| 37 | +const LinkingTooltipContent = () => ( |
| 38 | + <div className={styles.linkedTooltip}> |
| 39 | + <div className={styles.tooltipHeader}> |
| 40 | + <img src={lightbulbIcon} /> |
| 41 | + {t('collection_row.linking_tooltip.title')} |
| 42 | + </div> |
| 43 | + <LinkingTooltipMappingType type={MappingType.ANY} /> |
| 44 | + <LinkingTooltipMappingType type={MappingType.SINGLE} /> |
| 45 | + <LinkingTooltipMappingType type={MappingType.MULTIPLE} /> |
| 46 | + <LinkingTooltipMappingType type={MappingType.RANGE} /> |
| 47 | + </div> |
| 48 | +) |
4 | 49 |
|
5 | 50 | export const CollectionItemHeaderV2 = ({ areAllSelected, onSelectedAllClick }: Props) => {
|
6 | 51 | return (
|
7 |
| - <Grid columns="equal" className="grid-header secondary-text"> |
| 52 | + <Grid columns="equal" className={styles.gridHeader}> |
8 | 53 | <Grid.Row>
|
9 |
| - <Grid.Column width={4} className="item-column"> |
10 |
| - <Checkbox className="item-checkbox" checked={areAllSelected} onClick={onSelectedAllClick} /> |
| 54 | + <Grid.Column width={4} className={styles.itemColumn}> |
| 55 | + <Checkbox className={styles.itemCheckbox} checked={areAllSelected} onClick={onSelectedAllClick} /> |
11 | 56 |
|
12 | 57 | {t('global.item')}
|
13 | 58 | </Grid.Column>
|
14 |
| - <Grid.Column>Linked to</Grid.Column> |
| 59 | + <Grid.Column className={styles.linkedToColumn}> |
| 60 | + <span>{t('third_party_collection_detail_page.linked_to')}</span> |
| 61 | + <InfoTooltip> |
| 62 | + <LinkingTooltipContent /> |
| 63 | + </InfoTooltip> |
| 64 | + </Grid.Column> |
15 | 65 | <Grid.Column width={2}> {t('collection_row.status')} </Grid.Column>
|
16 | 66 | <Grid.Column width={1}></Grid.Column>
|
17 | 67 | </Grid.Row>
|
|
0 commit comments