Skip to content

Commit

Permalink
feat: add zoom out toolbar (#428)
Browse files Browse the repository at this point in the history
Parts of #264
  • Loading branch information
Sebastien-Ahkrin committed Nov 30, 2022
1 parent e8411d6 commit f0720f3
Showing 1 changed file with 41 additions and 6 deletions.
47 changes: 41 additions & 6 deletions src/app/kinds/iv/plot-view/IvPlotView.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,58 @@
/** @jsxImportSource @emotion/react */
import { css } from '@emotion/react';
import { FaCompress } from 'react-icons/fa';
import { PlotController } from 'react-plot';

import { useAppDispatch, useAppState } from '../../../../app-data/index';
import { Toolbar } from '../../../../components/index';

import IvMeasurementsPlot from './IvMeasurementsPlot';

export function IvPlotView() {
return (
<div
css={css`
display: flex;
flex-direction: column;
flex-direction: row;
height: 100%;
width: 100%;
`}
>
<PlotController>
<IvMeasurementsPlot />
</PlotController>
<div>TODO: add variable selectors</div>
<VerticalToolbar />
<div
css={css`
display: flex;
flex-direction: column;
height: 100%;
width: 100%;
`}
>
<PlotController>
<IvMeasurementsPlot />
</PlotController>

<div>TODO: add variable selectors</div>
</div>
</div>
);
}

function VerticalToolbar() {
const dispatch = useAppDispatch();
const {
view: { selectedKind },
} = useAppState();

function onZoomOut() {
if (selectedKind) {
dispatch({ type: 'PLOT_ZOOM_OUT', payload: { kind: selectedKind } });
}
}

return (
<Toolbar orientation="vertical">
<Toolbar.Item onClick={onZoomOut} title="Zoom out">
<FaCompress />
</Toolbar.Item>
</Toolbar>
);
}

0 comments on commit f0720f3

Please sign in to comment.