1
1
2
- import { jsx } from '@emotion/react' ;
2
+ import { jsx , css } from '@emotion/react' ;
3
3
import React , { useContext , useState , useEffect } from 'react' ;
4
4
import ThemeContext from '../../../style/themes/ThemeContext' ;
5
- import * as css from '../styles' ;
5
+ import * as styles from '../styles' ;
6
6
import { Row , Col , Image , Properties , IconFeatures } from "../../../components" ;
7
7
import { useQuery } from '../../../dataManagement/api' ;
8
8
import { Header } from './Header' ;
@@ -35,8 +35,14 @@ export function Cluster({
35
35
}
36
36
37
37
return < div style = { { padding : '12px 16px' } } >
38
- < Header data = { data } />
39
- < div style = { { marginTop : 24 } } >
38
+ { /* Based on feedback in https://github.com/gbif/hosted-portals/issues/263 I have removed the header and instead repeated the information in a format similar to the other clustered records */ }
39
+ { /* <Header data={data} /> */ }
40
+ < div >
41
+ < RelatedOccurrence onClick = { e => setActiveKey ( data . occurrence . key ) } related = { data . occurrence } css = { css `
42
+ border-color : var (--primary );
43
+ background : var (--paperBackground700 );
44
+ border-radius : var (--borderRadiusPx );
45
+ ` } />
40
46
{ related . map ( x => {
41
47
if ( x . occurrence ) {
42
48
return < RelatedOccurrence key = { x . occurrence . key } onClick = { e => setActiveKey ( x . occurrence . key ) } related = { x . occurrence } reasons = { x . reasons } original = { data . occurrence } /> ;
@@ -61,17 +67,17 @@ export function Cluster({
61
67
62
68
export function RelatedOccurrence ( { original, reasons, related, ...props } ) {
63
69
const theme = useContext ( ThemeContext ) ;
64
- return < article css = { css . clusterCard ( { theme } ) } { ...props } >
70
+ return < article css = { styles . clusterCard ( { theme } ) } { ...props } >
65
71
< Row wrap = "nowrap" halfGutter = { 6 } style = { { padding : 12 } } >
66
72
< Col >
67
73
< h4 style = { { margin : 0 } } dangerouslySetInnerHTML = { { __html : related . gbifClassification . usage . formattedName } } > </ h4 >
68
- < div css = { css . entitySummary ( { theme } ) } >
69
- < IconFeatures css = { css . features ( { theme } ) }
74
+ < div css = { styles . entitySummary ( { theme } ) } >
75
+ < IconFeatures css = { styles . features ( { theme } ) }
70
76
eventDate = { related . eventDate }
71
77
countryCode = { related . countryCode }
72
78
locality = { related . locality }
73
79
/>
74
- < IconFeatures css = { css . features ( { theme } ) }
80
+ < IconFeatures css = { styles . features ( { theme } ) }
75
81
stillImageCount = { related . stillImageCount }
76
82
movingImageCount = { related . movingImageCount }
77
83
soundCount = { related . soundCount }
@@ -98,11 +104,12 @@ export function RelatedOccurrence({ original, reasons, related, ...props }) {
98
104
</ div >
99
105
</ Col >
100
106
</ Row >
101
- < div css = { css . clusterFooter ( { theme } ) } >
102
- < Properties style = { { fontSize : 12 } } horizontal dense >
107
+ < div css = { styles . clusterFooter ( { theme } ) } >
108
+ { ! reasons && < div > Current record</ div > }
109
+ { reasons && < Properties style = { { fontSize : 12 } } horizontal dense >
103
110
< T > Similarities</ T >
104
- < V > { reasons . map ( reason => < span css = { css . chip ( { theme } ) } key = { reason } > { prettifyEnum ( reason ) } </ span > ) } </ V >
105
- </ Properties >
111
+ < V > { reasons . map ( reason => < span css = { styles . chip ( { theme } ) } key = { reason } > { prettifyEnum ( reason ) } </ span > ) } </ V >
112
+ </ Properties > }
106
113
</ div >
107
114
</ article >
108
115
} ;
0 commit comments