-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
225 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { styled } from '@mui/material' | ||
|
||
interface InfoContentProps { | ||
id: string | ||
mean: number | ||
std: number | ||
sample_size: number | ||
pos: { x: number; y: number } | ||
} | ||
|
||
const InfoContent = ({ id, mean, std, sample_size, pos }: InfoContentProps) => { | ||
return ( | ||
<StyledInfoContent x={pos.x} y={pos.y}> | ||
<p> | ||
<strong>{id}</strong> | ||
</p> | ||
<p>Mean: {mean}</p> | ||
<p>Standard error: {std}</p> | ||
<p>Sample size: {sample_size}</p> | ||
</StyledInfoContent> | ||
) | ||
} | ||
|
||
const StyledInfoContent = styled('div')<{ x: number; y: number }>( | ||
({ theme, x, y }) => ({ | ||
position: 'absolute', | ||
top: y, | ||
left: x, | ||
border: '1px solid #ccc', | ||
backgroundColor: theme.palette.background.active, | ||
padding: '10px', | ||
borderRadius: '10px', | ||
boxShadow: '0 0 10px rgba(0, 0, 0, 0.1)', | ||
transform: 'translate(-50%, -50%)', | ||
maxWidth: '200px', | ||
width: '200px', | ||
'& p': { | ||
margin: '5px 0', | ||
}, | ||
'& strong': { | ||
display: 'block', | ||
marginBottom: '10px', | ||
}, | ||
}) | ||
) | ||
|
||
export default InfoContent |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { Popper } from '@mui/material' | ||
import { useState } from 'react' | ||
|
||
export default function WorldEFPPopper() { | ||
const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null) | ||
|
||
const handleClick = (event: React.MouseEvent<HTMLElement>) => { | ||
setAnchorEl(anchorEl ? null : event.currentTarget) | ||
} | ||
|
||
const open = Boolean(anchorEl) | ||
const id = open ? 'simple-popper' : undefined | ||
|
||
return ( | ||
<div> | ||
<Popper id={id} open={open} anchorEl={anchorEl}> | ||
<StyledPopperDiv>The content of the Popper.</StyledPopperDiv> | ||
</Popper> | ||
</div> | ||
) | ||
} | ||
|
||
const StyledPopperDiv = styled('div')( | ||
({ theme }) => css` | ||
Check failure on line 24 in Eplant/views/WorldEFP/WorldEFPPopper.tsx GitHub Actions / build
|
||
background-color: ${theme.palette.mode === 'dark' ? grey[900] : '#fff'}; | ||
border-radius: 8px; | ||
border: 1px solid ${theme.palette.mode === 'dark' ? grey[700] : grey[200]}; | ||
Check failure on line 27 in Eplant/views/WorldEFP/WorldEFPPopper.tsx GitHub Actions / build
|
||
box-shadow: ${theme.palette.mode === 'dark' | ||
? `0px 4px 8px rgb(0 0 0 / 0.7)` | ||
: `0px 4px 8px rgb(0 0 0 / 0.1)`}; | ||
padding: 0.75rem; | ||
color: ${theme.palette.mode === 'dark' ? grey[100] : grey[700]}; | ||
Check failure on line 32 in Eplant/views/WorldEFP/WorldEFPPopper.tsx GitHub Actions / build
|
||
font-size: 0.875rem; | ||
font-family: 'IBM Plex Sans', sans-serif; | ||
font-weight: 500; | ||
opacity: 1; | ||
margin: 0.25rem 0; | ||
` | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { mix } from 'color2k' | ||
|
||
import { Theme } from '@mui/material' | ||
|
||
export const getWorldEFPColour = (theme: Theme, value: number, max: number) => { | ||
const ratio = value / max | ||
return mix( | ||
theme.palette.neutral.main, | ||
theme.palette.hot.main, | ||
Math.abs(ratio) | ||
) | ||
} |