-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add analysis metrics menu to chart (#860)
This PR adds the analysis metrics menu back to each layer list item in the explorations page. Ticket [here](#856) Design [here](#856 (comment)) Question for @faustoperez related to icon button location. I moved the button closer to the right-aligned because of the overlapping arrows. Please let me know what you think. I discuss this more in the demo video if you can take a look. Thanks! Demo vid: https://www.loom.com/share/56d013aade7945fdb40bff8cd2f3dc56
- Loading branch information
Showing
3 changed files
with
67 additions
and
4 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
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
41 changes: 41 additions & 0 deletions
41
app/scripts/components/exploration/components/datasets/layer-chart-analysis-menu.tsx
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,41 @@ | ||
import React from 'react'; | ||
import styled from 'styled-components'; | ||
import { Dropdown } from '@devseed-ui/dropdown'; | ||
import AnalysisMetrics, { DataMetric } from './analysis-metrics'; | ||
import { TipButton } from '$components/common/tip-button'; | ||
|
||
|
||
interface ChartAnalysisProps { | ||
triggerIcon: JSX.Element; | ||
onChange: (changeType: string, item) => void; | ||
activeMetrics: DataMetric[]; | ||
} | ||
|
||
const IconButton = styled(TipButton)` | ||
z-index: 1; | ||
`; | ||
|
||
export default function LayerChartAnalysisMenu ({activeMetrics, triggerIcon, onChange}: ChartAnalysisProps) { | ||
return ( | ||
<Dropdown | ||
alignment='right' | ||
direction='up' | ||
triggerElement={(props) => ( | ||
<IconButton | ||
tipContent='Analysis metrics' | ||
variation='base-text' | ||
size='small' | ||
fitting='skinny' | ||
{...props} | ||
> | ||
{triggerIcon} | ||
</IconButton> | ||
)} | ||
> | ||
<AnalysisMetrics | ||
activeMetrics={activeMetrics} | ||
onMetricsChange={(m) => onChange('analysisMetrics', m)} | ||
/> | ||
</Dropdown> | ||
); | ||
} |