Skip to content

Commit

Permalink
TimeElement with spans
Browse files Browse the repository at this point in the history
  • Loading branch information
v-rocheleau committed Oct 16, 2023
1 parent 1127f46 commit be7091c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 20 deletions.
4 changes: 2 additions & 2 deletions src/components/explorer/IndividualBiosamples.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ const BiosampleProcedure = ({ resourcesTuple, procedure }) => (
) : null}
{procedure.performed ? (
<div>
<strong>Time Performed:</strong>{" "}
<TimeElement timeElement={procedure.performed}/>
<strong>Performed:</strong>{" "}
<TimeElement timeElement={procedure.performed} />
</div>
): null}
</div>
Expand Down
34 changes: 16 additions & 18 deletions src/components/explorer/TimeElement.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,31 +29,29 @@ const getTimeElementTypeLabel = (timeElement) => {
const renderTimeElement = (type, timeElement) => {
switch (type) {
case "age":
return <>{timeElement.age.iso8601duration}</>;
return <span>{timeElement.age.iso8601duration}</span>;
case "gestational_age":
return <>
<strong>Weeks:</strong>{" "}{timeElement.gestationalAge.weeks}
return <span>
<strong>Weeks:</strong>{" "}{timeElement.gestationalAge.weeks}{" "}
<strong>Days:</strong>{" "}{timeElement.gestationalAge.days}
</>;
</span>;
case "age_range":
return <>
<strong>Start:</strong>{" "}<>{timeElement.age_range.start.iso8601duration}</>
return <span>
<strong>Start:</strong>{" "}<>{timeElement.age_range.start.iso8601duration}</>{" "}
<strong>End:</strong>{" "}<>{timeElement.age_range.end.iso8601duration}</>
</>;
</span>;
case "ontology_class":
return <>
<strong>ID:</strong>{" "}{timeElement.ontology_class.id}
return <span>
<strong>ID:</strong>{" "}{timeElement.ontology_class.id}{" "}
<strong>Label:</strong>{" "}{timeElement.ontology_class.label}
</>;
</span>;
case "timestamp":
return <>
<strong>Timestamp:</strong>{" "}{timeElement.timestamp}
</>;
return <span>{timeElement.timestamp}</span>;
case "interval":
return <>
<strong>Start:</strong>{" "}<>{timeElement.interval.start}</>
return <span>
<strong>Start:</strong>{" "}<>{timeElement.interval.start}</>{" "}
<strong>End:</strong>{" "}<>{timeElement.interval.end}</>
</>;
</span>;
default:
return EM_DASH;
}
Expand All @@ -68,10 +66,10 @@ const TimeElement = ({timeElement}) => {
}

return (
<div>
<span>
<strong>{label}: </strong>
{renderTimeElement(timeType, timeElement)}
</div>
</span>
);
}

Expand Down

0 comments on commit be7091c

Please sign in to comment.