Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix species triangle #1132

Merged
merged 1 commit into from
Jun 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/containers/datasets/species-distribution/widget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,12 @@ const SpeciesDistribution = () => {
} = useMangroveSpecies();

const isWorldwide = location === 'Worldwide';
// const total = data?.total;
const ref = useRef<HTMLDivElement>(null);

const ref = createRef<HTMLDivElement>();
const trianglePosition = (total * lineChartWidth) / worldwideTotal - 11; // substract icon size

// fires synchronously after all DOM mutations.
useEffect(() => {
useLayoutEffect(() => {
if (ref && ref.current && ref.current.offsetWidth) {
setLineChartWidth(ref?.current?.offsetWidth);
}
Expand Down
Loading