Skip to content

Commit

Permalink
Allow chart metrics to be configured per dataset analysed
Browse files Browse the repository at this point in the history
Fix #669
  • Loading branch information
danielfdsilva committed Sep 23, 2023
1 parent e870dc3 commit c6e0f54
Show file tree
Hide file tree
Showing 6 changed files with 270 additions and 234 deletions.
199 changes: 0 additions & 199 deletions app/scripts/components/analysis/results/analysis-head-actions.tsx

This file was deleted.

79 changes: 79 additions & 0 deletions app/scripts/components/analysis/results/analysis-head.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
import React, { Fragment } from 'react';
import styled, { useTheme } from 'styled-components';
import { media } from '@devseed-ui/theme-provider';
import { Button } from '@devseed-ui/button';

import { DATA_METRICS } from './analysis-metrics-dropdown';

import { FoldHeadActions } from '$components/common/fold';
import {
Legend,
LegendTitle,
LegendList,
LegendSwatch,
LegendLabel
} from '$styles/infographics';

const AnalysisFoldHeadActions = styled(FoldHeadActions)`
width: 100%;
${media.mediumUp`
width: auto;
`}
${Button} {
margin-left: auto;
}
`;

const AnalysisLegend = styled(Legend)`
flex-flow: column nowrap;
align-items: flex-start;
${media.smallUp`
flex-flow: row nowrap;
align-items: center;
`};
`;

const AnalysisLegendList = styled(LegendList)`
display: grid;
grid-template-columns: repeat(6, auto);
${media.smallUp`
display: flex;
flex-flow: row nowrap;
`};
`;

export default function AnalysisHead() {
const theme = useTheme();

return (
<AnalysisFoldHeadActions>
<AnalysisLegend>
<LegendTitle>Legend</LegendTitle>
<AnalysisLegendList>
{DATA_METRICS.map((metric) => {
return (
<Fragment key={metric.id}>
<LegendSwatch>
<svg height='8' width='8'>
<title>{theme.color?.[metric.themeColor]}</title>
<circle
cx='4'
cy='4'
r='4'
fill={theme.color?.[metric.themeColor]}
/>
</svg>
</LegendSwatch>
<LegendLabel>{metric.label}</LegendLabel>
</Fragment>
);
})}
</AnalysisLegendList>
</AnalysisLegend>
</AnalysisFoldHeadActions>
);
}
Loading

0 comments on commit c6e0f54

Please sign in to comment.