import styled from '@emotion/styled'; import { memo, useMemo, useState } from 'react'; import { useWatch } from 'react-hook-form'; import { Sections } from '../../../../elements/Sections.tsx'; import PlotChart from './PlotChart.js'; import { processSnapPlot } from './processSnapPlot.js'; const Container = styled.div` display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 10px 0; `; const BlockContainer = styled.div` display: block; `; const yLogBase = 2; interface Spectrum1DHistogramProps { color?: string; data: any; } function Spectrum1DHistogram({ color = 'red', data, }: Spectrum1DHistogramProps) { const processedData = useMemo(() => { return processSnapPlot('1D', data, yLogBase); }, [data]); const [isOpen, setIsOpen] = useState(false); const isApplyToAllSelected = useWatch({ name: 'applyToAll' }); if (isApplyToAllSelected) return null; return ( setIsOpen(!isOpen)} > ); } export default memo(Spectrum1DHistogram);