Skip to content

Commit e531c18

Browse files
committed
fix: Adds a open on another page link to species in the gbi page
1 parent 845b122 commit e531c18

File tree

1 file changed

+39
-3
lines changed

1 file changed

+39
-3
lines changed

src/components/charts/GrasslandButterflyIndex.tsx

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import { Line, Bar } from "react-chartjs-2";
2-
import { Card, Alert, Collapse, Row, Col, Divider, Typography } from "antd";
2+
import { Card, Alert, Collapse, Row, Col, Divider, Typography, Tooltip } from "antd";
3+
import { ExportOutlined } from "@ant-design/icons";
4+
import { Link } from "react-router-dom";
35
import { GBIData, RegionalGBICollection } from "../../types/gbiData";
46
import { BASELINE_YEAR, getTrendColor, TREND_COLORS, TREND_LABELS } from "../../constants";
57
import { RegionalGBITrends } from "./RegionalGBITrends";
@@ -665,7 +667,24 @@ function GrasslandButterflyIndex({
665667
<Row gutter={[16, 16]}>
666668
{widespreadSpecies.map(species => (
667669
<Col span={8} key={species}>
668-
<Card size="small" title={<span style={{ fontSize: 12 }}>{species}</span>}>
670+
<Card
671+
size="small"
672+
title={
673+
<div style={{ display: "flex", alignItems: "center", gap: 8 }}>
674+
<span style={{ fontSize: 12, fontStyle: "italic" }}>{species}</span>
675+
<Tooltip title="Abrir página da espécie em novo separador">
676+
<Link
677+
to={`/species/${encodeURIComponent(species)}`}
678+
target="_blank"
679+
rel="noopener noreferrer"
680+
style={{ color: "#1890ff", fontSize: 11 }}
681+
>
682+
<ExportOutlined />
683+
</Link>
684+
</Tooltip>
685+
</div>
686+
}
687+
>
669688
<div style={{ height: "200px" }}>
670689
<Line
671690
options={createMiniChartOptions(species)}
@@ -685,7 +704,24 @@ function GrasslandButterflyIndex({
685704
<Row gutter={[16, 16]}>
686705
{specialistSpecies.map(species => (
687706
<Col span={8} key={species}>
688-
<Card size="small" title={<span style={{ fontSize: 12 }}>{species}</span>}>
707+
<Card
708+
size="small"
709+
title={
710+
<div style={{ display: "flex", alignItems: "center", gap: 8 }}>
711+
<span style={{ fontSize: 12, fontStyle: "italic" }}>{species}</span>
712+
<Tooltip title="Abrir página da espécie em novo separador">
713+
<Link
714+
to={`/species/${encodeURIComponent(species)}`}
715+
target="_blank"
716+
rel="noopener noreferrer"
717+
style={{ color: "#1890ff", fontSize: 11 }}
718+
>
719+
<ExportOutlined />
720+
</Link>
721+
</Tooltip>
722+
</div>
723+
}
724+
>
689725
<div style={{ height: "200px" }}>
690726
<Line
691727
options={createMiniChartOptions(species)}

0 commit comments

Comments
 (0)