Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F81546871
ResultCard.js
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Fri, Sep 6, 16:25
Size
1 KB
Mime Type
text/x-java
Expires
Sun, Sep 8, 16:25 (2 d)
Engine
blob
Format
Raw Data
Handle
20594954
Attached To
rOACCT Open Access Compliance Check Tool (OACCT)
ResultCard.js
View Options
import
React
,
{
useState
}
from
"react"
import
{
makeStyles
}
from
'@material-ui/core/styles'
;
import
TermCard
from
"../components/TermCard"
function
ResultCard
({
result
})
{
console
.
log
(
result
)
const
condition
=
result
.
map
(
i
=>
(
i
.
condition_type
.
id
))
//create distinct array
const
distinctCondi
=
Array
.
from
(
new
Set
(
condition
))
const
showDistinct
=
distinctCondi
.
map
(
i
=>
(
<
div
>
<
h1
>
{
i
}
<
/h1>
<
/div>
))
console
.
log
(
`
condition
:
$
{
condition
}
`
)
console
.
log
(
`
Distinct
condition
:
$
{
distinctCondi
}
`
)
// const term = result.map(i=>(
// i.term.map( term => (
// <TermCard key={term.id} term={term}/>
// ))
// ))
function
term
()
{
const
termVersion
=
result
.
map
(
i
=>
(
i
.
term
.
map
(
i
=>
(
i
.
version
.
map
(
j
=>
(
j
.
description
))
))
))
const
termItem
=
result
.
map
(
i
=>
(
i
.
term
.
map
(
term
=>
(
<
TermCard
key
=
{
term
.
id
}
term
=
{
term
}
version
=
{
termVersion
}
/>
))
))
return
(
<>
{
termItem
}
<
/>
)
console
.
log
(
termVersion
)
}
return
(
<
div
key
=
{
result
.
id
}
>
{
term
()}
<
/div>
)
}
export
default
ResultCard
Event Timeline
Log In to Comment