diff --git a/src/component/1d-2d/FieldEdition.tsx b/src/component/1d-2d/FieldEdition.tsx index b90244ef1c..d1ed63cae1 100644 --- a/src/component/1d-2d/FieldEdition.tsx +++ b/src/component/1d-2d/FieldEdition.tsx @@ -1,7 +1,6 @@ -/** @jsxImportSource @emotion/react */ import type { PopoverProps } from '@blueprintjs/core'; import { Popover } from '@blueprintjs/core'; -import { css } from '@emotion/react'; +import styled from '@emotion/styled'; import { yupResolver } from '@hookform/resolvers/yup'; import type { ReactNode } from 'react'; import { useState } from 'react'; @@ -11,6 +10,12 @@ import * as Yup from 'yup'; import { Input2Controller } from '../elements/Input2Controller.js'; import { NumberInput2Controller } from '../elements/NumberInput2Controller.js'; +const StyledPopover = styled(Popover)` + .field-edition-popover { + border-radius: 5px; + } +`; + type InputType = 'number' | 'text'; interface FieldProps { @@ -51,12 +56,7 @@ export function FieldEdition(props: FieldEditionsProps) { } return ( - setIsOpen(false)} @@ -67,7 +67,7 @@ export function FieldEdition(props: FieldEditionsProps) { {...PopoverProps} > {children} - + ); } diff --git a/src/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.tsx b/src/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.tsx index 352f255269..4fd7673964 100644 --- a/src/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.tsx +++ b/src/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.tsx @@ -1,5 +1,4 @@ -/** @jsxImportSource @emotion/react */ -import { css } from '@emotion/react'; +import styled from '@emotion/styled'; import type { Ranges, Zones } from 'nmr-processing'; import OCL from 'openchemlib/full'; import { ResponsiveChart } from 'react-d3-utils'; @@ -32,7 +31,7 @@ interface DraggableStructureProps { const AUTO_CROP_MARGIN = 30; -const style = css` +const ReactRnd = styled(Rnd)` border: 1px solid transparent; button { @@ -100,7 +99,7 @@ export function DraggableStructure(props: DraggableStructureProps) { if (!viewerRef) return null; return ( -
{modal} -
+ ); } diff --git a/src/component/1d/ExclusionZoneAnnotation.tsx b/src/component/1d/ExclusionZoneAnnotation.tsx index d630e601c8..9f6d738a26 100644 --- a/src/component/1d/ExclusionZoneAnnotation.tsx +++ b/src/component/1d/ExclusionZoneAnnotation.tsx @@ -1,5 +1,4 @@ -/** @jsxImportSource @emotion/react */ -import { css } from '@emotion/react'; +import styled from '@emotion/styled'; import { Filters1D } from 'nmr-processing'; import { memo } from 'react'; @@ -16,7 +15,7 @@ interface ExclusionZoneProps { filterId: string; } -const style = css` +const Rect = styled.rect` &:hover { fill: #ff6f0057 !important; } @@ -43,9 +42,8 @@ function ExclusionZoneAnnotation({ return ( - width - margin.right || position.y > height - margin.bottom ) { - return
; + return ; } function getXIndex(xPosition) { @@ -135,82 +83,82 @@ function FooterBannerInner({ const isBrushing = step === 'brushing' && mouseButton === 'main'; return ( -
+
- đť›…: - {format(scaleX().invert(position.x))} - ppm + đť›…: + {format(scaleX().invert(position.x))} + ppm {activeSpectrum && spectrum?.info?.originFrequency && ( <> - +  ( {format( scaleX().invert(position.x) * spectrum?.info?.originFrequency, 'hz', )} - - Hz - ) - + + Hz + ) + , - Index: - {getXIndex(position.x)} - + Index: + {getXIndex(position.x)} + )}
{isBrushing && ( -
- Δppm: - + + Δppm: + {(scaleX().invert(startX) - scaleX().invert(endX)).toPrecision(6)} - -
+ + )} {activeSpectrum && ( -
+ {spectrum?.info?.originFrequency && isBrushing && (
- ΔHz: - + ΔHz: + {( (scaleX().invert(startX) - scaleX().invert(endX)) * spectrum?.info?.originFrequency ).toPrecision(5)} - +
)} {isBrushing && (
- ratio : - + ratio : + {( (getYValue(startX) / (getYValue(endX) || Number.MIN_VALUE)) * 100 ).toFixed(2)} % - +
)} -
+ )} {activeSpectrum && ( -
-
+ +
- Intensity: - + Intensity: + {format(getYValue(position.x))} - +
-
+ )} -
+
); } diff --git a/src/component/1d/LinesSeries.tsx b/src/component/1d/LinesSeries.tsx index 68910a9b33..6ea29adab9 100644 --- a/src/component/1d/LinesSeries.tsx +++ b/src/component/1d/LinesSeries.tsx @@ -1,5 +1,4 @@ -/** @jsxImportSource @emotion/react */ -import { css } from '@emotion/react'; +import styled from '@emotion/styled'; import type { Spectrum1D } from 'nmr-load-save'; import { get1DDataXY } from '../../data/data1d/Spectrum1D/get1DDataXY.js'; @@ -16,7 +15,7 @@ import { SPECTRA_BOTTOM_MARGIN } from './utilities/scale.js'; const BOX_SIZE = 10; -const style = css` +const Rect = styled.rect` fill: transparent; &:hover { @@ -76,8 +75,7 @@ function HeadlightRectStackMode(props: HeadlightRectStackModeProps) { } return ( - {show && ( - {label} - + )} {showGrid && ( - {show && ( - @@ -63,7 +48,7 @@ function YAxis(props: YAxisProps) { > {label} - + )} ); diff --git a/src/component/1d/integral/IntegralResizable.tsx b/src/component/1d/integral/IntegralResizable.tsx index d8cc813d61..17b15a1c0a 100644 --- a/src/component/1d/integral/IntegralResizable.tsx +++ b/src/component/1d/integral/IntegralResizable.tsx @@ -1,5 +1,4 @@ -/** @jsxImportSource @emotion/react */ -import { css } from '@emotion/react'; +import styled from '@emotion/styled'; import type { Integral } from 'nmr-processing'; import { useChartData } from '../../context/ChartContext.js'; @@ -11,21 +10,13 @@ import { useResizerStatus } from '../../hooks/useResizerStatus.js'; import { IntegralIndicator } from './IntegralIndicator.js'; -const stylesOnHover = css` - .highlight { - fill: transparent; +const Group = styled.g<{ isActive: boolean }>` + rect { + fill: ${(props) => (props.isActive ? '#ff6f0057' : 'transparent')}; } .target { - visibility: hidden; - } -`; - -const stylesHighlighted = css` - fill: #ff6f0057; - - .target { - visibility: visible; + visibility: ${(props) => (props.isActive ? 'visible' : 'hidden')}; } `; @@ -79,25 +70,14 @@ function IntegralResizable({ const width = x2 - x1; return ( - - + + - + ); }} diff --git a/src/component/1d/multiplicityTree/MultiplicityTree.tsx b/src/component/1d/multiplicityTree/MultiplicityTree.tsx index e47050cb59..293d85bb9a 100644 --- a/src/component/1d/multiplicityTree/MultiplicityTree.tsx +++ b/src/component/1d/multiplicityTree/MultiplicityTree.tsx @@ -1,5 +1,4 @@ -/** @jsxImportSource @emotion/react */ -import { css } from '@emotion/react'; +import styled from '@emotion/styled'; import { xFindClosestIndex } from 'ml-spectra-processing'; import type { Spectrum1D } from 'nmr-load-save'; import type { Range } from 'nmr-processing'; @@ -20,15 +19,13 @@ import { AssignmentActionsButtons } from '../ranges/AssignmentActionsButtons.js' import type { TreeNodes } from './generateTreeNodes.js'; import { generateTreeNodes } from './generateTreeNodes.js'; -const styles = { - cursor: 'default', - opacity: 0.6, - strokeWidth: 1, -}; +const Group = styled.g<{ isActive: boolean; isHighlighted: boolean }>` + cursor: default; + opacity: ${({ isHighlighted }) => (isHighlighted ? '1' : '0.6')}; + stroke-width: ${({ isHighlighted }) => (isHighlighted ? '1.5' : '1')}px; -const cssStyle = css` .signal-target { - visibility: hidden; + visibility: ${({ isActive }) => (isActive ? 'visible' : 'hidden')}; } &:hover { @@ -159,10 +156,9 @@ function Tree(props: TreeProps) { treeHeight + headTextMargin + multiplicityTextSize + padding * 2; return ( - { assignment.show('x'); highlight.show(); @@ -172,7 +168,6 @@ function Tree(props: TreeProps) { highlight.hide(); }} pointerEvents="bounding-box" - {...(!assignment.isActive && { css: cssStyle })} > - + ); } diff --git a/src/component/1d/ranges/Range.tsx b/src/component/1d/ranges/Range.tsx index ae5fc0c5b3..0659e33fe4 100644 --- a/src/component/1d/ranges/Range.tsx +++ b/src/component/1d/ranges/Range.tsx @@ -1,5 +1,4 @@ -/** @jsxImportSource @emotion/react */ -import { css } from '@emotion/react'; +import styled from '@emotion/styled'; import type { Range as RangeType } from 'nmr-processing'; import { LuLink, LuUnlink } from 'react-icons/lu'; import { PiTextTBold, PiTextTSlashBold } from 'react-icons/pi'; @@ -34,9 +33,9 @@ import { useScaleX } from '../utilities/scale.js'; import { AssignmentLabel } from './AssignmentLabel.js'; import { Atoms } from './Atoms.js'; -const style = css` +const Group = styled.g<{ isActive: boolean }>` .target { - visibility: hidden; + visibility: ${({ isActive }) => (isActive ? 'visible' : 'hidden')}; } &:hover { @@ -180,13 +179,13 @@ function Range({ range, selectedTool, relativeFormat }: RangeProps) { }, ]; return ( - - + ); } diff --git a/src/component/2d/1d-tracer/phase-correction-traces/SpectraPhaseTraces.tsx b/src/component/2d/1d-tracer/phase-correction-traces/SpectraPhaseTraces.tsx index f6ddff0777..702c8a9d83 100644 --- a/src/component/2d/1d-tracer/phase-correction-traces/SpectraPhaseTraces.tsx +++ b/src/component/2d/1d-tracer/phase-correction-traces/SpectraPhaseTraces.tsx @@ -1,5 +1,4 @@ -/** @jsxImportSource @emotion/react */ -import { css } from '@emotion/react'; +import styled from '@emotion/styled'; import { useChartData } from '../../../context/ChartContext.js'; import { @@ -16,7 +15,7 @@ import { useActivePhaseTraces } from './useActivePhaseTraces.js'; const BOX_SIZE = 20; -const style = css` +const Rect = styled.rect` fill: transparent; &:hover { @@ -69,8 +68,7 @@ function PhaseTrace(props: SpectrumTraceProps) { {...highlight.onHover} > {direction === 'horizontal' && ( - )} {direction === 'vertical' && ( - height - margin.bottom || !data1D ) { - return
; + return ; } const getRealYValue = (coordinate) => { let index: number | null = null; @@ -272,36 +230,36 @@ function FooterBanner({ layout, data1D }) { const isBrushing = step === 'brushing' && mouseButton === 'main'; return ( -
-
- {getLabel('F2', 'X', nuclei[0])} : - {formatX(getXValue())} - ppm -
+ + + {getLabel('F2', 'X', nuclei[0])} : + {formatX(getXValue())} + ppm + -
- {getLabel('F1', 'Y', nuclei[1])} : - {formatY(getYValue())} - ppm -
-
- Intensity : - {getZValue()} -
+ + {getLabel('F1', 'Y', nuclei[1])} : + {formatY(getYValue())} + ppm + + + Intensity : + {getZValue()} + {isBrushing && ( -
- Δppm : - {getDeltaX()} -
+ + Δppm : + {getDeltaX()} + )} {isBrushing && ( -
- ratio : - {getRation()}% -
+ + ratio : + {getRation()}% + )} -
+
); } diff --git a/src/component/2d/SignalDeltaLine.tsx b/src/component/2d/SignalDeltaLine.tsx index dbd90b7f94..c92f6145f9 100644 --- a/src/component/2d/SignalDeltaLine.tsx +++ b/src/component/2d/SignalDeltaLine.tsx @@ -1,11 +1,10 @@ -/** @jsxImportSource @emotion/react */ -import { css } from '@emotion/react'; +import styled from '@emotion/styled'; import { useChartData } from '../context/ChartContext.js'; import { useScale2DX, useScale2DY } from './utilities/scale.js'; -const lineStyle = css` +const Line = styled.line` stroke: green; stroke-width: 2; opacity: 0.5; @@ -26,8 +25,7 @@ function SignalDeltaLine({ delta, axis, show }: SignalDeltaLineProps) { if (axis === 'X') { return ( - {show && ( - {spectrum?.info?.isFid ? 'Time [sec]' : 'δ [ppm]'} - + )} ); diff --git a/src/component/2d/YAxis.tsx b/src/component/2d/YAxis.tsx index 9f6987ed2a..1800d69b2f 100644 --- a/src/component/2d/YAxis.tsx +++ b/src/component/2d/YAxis.tsx @@ -1,27 +1,13 @@ -/** @jsxImportSource @emotion/react */ -import { css } from '@emotion/react'; import * as d3 from 'd3'; import type { Spectrum2D } from 'nmr-load-save'; import { memo, useEffect, useRef } from 'react'; import { useChartData } from '../context/ChartContext.js'; +import { AxisGroup } from '../elements/AxisGroup.js'; import useSpectrum from '../hooks/useSpectrum.js'; import { useScale2DY } from './utilities/scale.js'; -const axisStyles = css` - user-select: none; - - path, - line { - fill: none; - stroke: black; - stroke-width: 1; - shape-rendering: crispedges; - user-select: none; - } -`; - const defaultMargin = { right: 50, top: 0, bottom: 0, left: 0 }; interface YAxisProps { @@ -62,9 +48,8 @@ function YAxis(props: YAxisProps) { } return ( - @@ -78,7 +63,7 @@ function YAxis(props: YAxisProps) { > {label} - + ); } diff --git a/src/component/2d/zones/IndicationLines.tsx b/src/component/2d/zones/IndicationLines.tsx index f47e4cafb5..4feb6eab3c 100644 --- a/src/component/2d/zones/IndicationLines.tsx +++ b/src/component/2d/zones/IndicationLines.tsx @@ -1,5 +1,4 @@ -/** @jsxImportSource @emotion/react */ -import { css } from '@emotion/react'; +import styled from '@emotion/styled'; import type { Spectrum1D } from 'nmr-load-save'; import { useEffect, useState } from 'react'; @@ -8,7 +7,7 @@ import { isSpectrum1D } from '../../../data/data1d/Spectrum1D/index.js'; import { useChartData } from '../../context/ChartContext.js'; import { useScale2DX, useScale2DY } from '../utilities/scale.js'; -const lineStyle = css` +const Line = styled.line` stroke: lightgrey; opacity: 0.7; `; @@ -66,8 +65,7 @@ function IndicationLines({ axis, show }: IndicationLinesProps) { {deltas1D.map((_delta, i) => { if (axis === 'X') { return ( - >` + display: flex; + flex-direction: ${(props) => props.flexDirection}; + gap: ${(props) => props.gap}px; + + button, + a[role='button'] { + border-radius: 50%; + min-width: 16px; + min-height: 16px; + font-size: 10px; + padding: 5px; + } +`; + export interface ActionsButtonsPopoverProps extends Omit { buttons: Array< @@ -42,24 +56,7 @@ export function ActionsButtonsPopover(props: ActionsButtonsPopoverProps) { interactionKind="hover" enforceFocus={false} content={ -
+ {buttons .filter((button) => button?.visible !== false) .map(({ title, visible, ...otherProps }, index) => ( @@ -69,7 +66,7 @@ export function ActionsButtonsPopover(props: ActionsButtonsPopoverProps) { {...otherProps} /> ))} -
+ } {...otherProps} > diff --git a/src/component/elements/ActiveButton.tsx b/src/component/elements/ActiveButton.tsx index 9b236b34b3..c226f5bd6c 100644 --- a/src/component/elements/ActiveButton.tsx +++ b/src/component/elements/ActiveButton.tsx @@ -1,11 +1,10 @@ -/** @jsxImportSource @emotion/react */ -import { css } from '@emotion/react'; +import styled from '@emotion/styled'; import type { CSSProperties, ReactNode } from 'react'; import { memo, useCallback } from 'react'; import ToolTip from './ToolTip/ToolTip.js'; -const styles = css` +const Button = styled.button` background-color: #f5f5f5; border: none; border-radius: 5px; @@ -57,16 +56,15 @@ function ActiveButton({ }, [onClick, value]); return ( - + ); } diff --git a/src/component/elements/Alert.tsx b/src/component/elements/Alert.tsx index ba4eb107be..8b5dab8b42 100644 --- a/src/component/elements/Alert.tsx +++ b/src/component/elements/Alert.tsx @@ -1,4 +1,3 @@ -/** @jsxImportSource @emotion/react */ import type { ButtonProps } from '@blueprintjs/core'; import { Button, Dialog, DialogBody, DialogFooter } from '@blueprintjs/core'; import styled from '@emotion/styled'; diff --git a/src/component/elements/AxisGroup.tsx b/src/component/elements/AxisGroup.tsx new file mode 100644 index 0000000000..618f31cd6f --- /dev/null +++ b/src/component/elements/AxisGroup.tsx @@ -0,0 +1,14 @@ +import styled from '@emotion/styled'; + +export const AxisGroup = styled.g` + user-select: none; + + path, + line { + fill: none; + stroke: black; + stroke-width: 1; + shape-rendering: crispedges; + user-select: none; + } +`; diff --git a/src/component/elements/ColorInput.tsx b/src/component/elements/ColorInput.tsx index 15e85933ab..fd89b1d44c 100644 --- a/src/component/elements/ColorInput.tsx +++ b/src/component/elements/ColorInput.tsx @@ -1,10 +1,9 @@ -/** @jsxImportSource @emotion/react */ -import { css } from '@emotion/react'; +import styled from '@emotion/styled'; import { useCallback, memo, useState, useEffect } from 'react'; import type { ColorPickerProps } from 'react-science/ui'; import { ColorPicker } from 'react-science/ui'; -const style = css` +const Container = styled.div` display: flex; margin: 5px 0; @@ -20,31 +19,6 @@ const style = css` text-align: center; } - .color { - width: 36px; - height: 14px; - border-radius: 2px; - } - - .swatch { - padding: 5px; - background: #fff; - border-radius: 1px; - box-shadow: 0 0 0 1px rgb(0 0 0 / 10%); - display: inline-block; - cursor: pointer; - } - - .color-popover { - position: absolute; - z-index: 2; - } - - .cover { - position: fixed; - inset: 0; - } - .chrome-picker { border-radius: 0 !important; width: 200px !important; @@ -65,6 +39,28 @@ const style = css` } `; +const Switch = styled.div` + padding: 5px; + background: #fff; + border-radius: 1px; + box-shadow: 0 0 0 1px rgb(0 0 0 / 10%); + display: inline-block; + cursor: pointer; +`; +const Color = styled.div` + width: 36px; + height: 14px; + border-radius: 2px; +`; +const ColorPopover = styled.div` + position: absolute; + z-index: 2; +`; +const Cover = styled.div` + position: fixed; + inset: 0; +`; + export interface ColorInputProps { value?: string; name: string; @@ -100,21 +96,21 @@ function ColorInput(props: ColorInputProps) { [name, onColorChange], ); return ( -
-
-
+ + + -
+ {displayColorPicker ? ( -
-
+ + -
+ ) : null} -
+ ); } diff --git a/src/component/elements/DraggableDialog.tsx b/src/component/elements/DraggableDialog.tsx index d2c835f3df..57bd7ac99b 100644 --- a/src/component/elements/DraggableDialog.tsx +++ b/src/component/elements/DraggableDialog.tsx @@ -15,7 +15,7 @@ import { Overlay2, } from '@blueprintjs/core'; import { SmallCross } from '@blueprintjs/icons'; -import { css, Global } from '@emotion/react'; +import { Global } from '@emotion/react'; import styled from '@emotion/styled'; import type { ReactNode, RefObject } from 'react'; import { useLayoutEffect, useRef } from 'react'; @@ -76,14 +76,13 @@ export function DraggableDialog(props: DraggableDialogProps) { return ( <> ` + margin: 0 10px; + display: ${({ display = 'inline-block' }) => display}; + + @container (max-width:600px) { + display: ${({ autoHide = false, display = 'inline-block' }) => + autoHide ? 'none' : display} !important; + } +`; + +interface InfoItemProps extends InfoContainerProps { + children: ReactNode; +} + +function InfoItem(props: InfoItemProps) { + const { children, autoHide = false, display = 'inline-block' } = props; + return ( + + {children} + + ); +} + +const Span = styled.span` + font-weight: bold; +`; + +InfoItem.Label = styled(Span)` + font-size: 12px; + color: #4d4d4d; +`; + +InfoItem.Value = styled(Span)` + font-size: 14px; +`; + +InfoItem.Unit = styled(Span)` + font-size: 10px; +`; + +export { InfoItem, FooterContainer }; diff --git a/src/component/elements/Input2Controller.tsx b/src/component/elements/Input2Controller.tsx index 98efb87aec..1126ca0778 100644 --- a/src/component/elements/Input2Controller.tsx +++ b/src/component/elements/Input2Controller.tsx @@ -1,7 +1,5 @@ -/** @jsxImportSource @emotion/react */ - import { FormGroup } from '@blueprintjs/core'; -import { css } from '@emotion/react'; +import styled from '@emotion/styled'; import type { ControllerProps, FieldValues } from 'react-hook-form'; import { Controller } from 'react-hook-form'; @@ -13,6 +11,17 @@ export interface InputMapValueFunctions { mapValue?: (value: any) => string; } +const CustomFormGroup = styled(FormGroup)<{ isFill?: boolean }>` + ${({ isFill }) => + isFill + ? ` + div { + flex: 1; + } + ` + : ''} +`; + interface Input2ControllerProps extends Omit, Pick, 'control' | 'name'>, @@ -78,20 +87,14 @@ export function Input2Controller< if (enableErrorMessage && error?.message) { return ( - {inputComponent} - + ); } diff --git a/src/component/elements/Label.tsx b/src/component/elements/Label.tsx index 40642ddf54..44035150d3 100644 --- a/src/component/elements/Label.tsx +++ b/src/component/elements/Label.tsx @@ -1,9 +1,12 @@ -/** @jsxImportSource @emotion/react */ -import { css } from '@emotion/react'; +import styled from '@emotion/styled'; import type { CSSProperties, LabelHTMLAttributes, ReactNode } from 'react'; import Button from './Button.js'; +const ShortTitle = styled.span` + display: none; +`; + export interface LabelStyle { label?: CSSProperties; wrapper?: CSSProperties; @@ -53,9 +56,7 @@ export default function Label(props: LabelProps) { {title} )} {shortTitle && ( - - {shortTitle} - + {shortTitle} )} {description && ( + {icon} {label} - + ); } export interface BoundingBox { @@ -90,8 +87,7 @@ function MenuList({ onClick, }: MenuListProps) { return ( -
onClick(item)} /> ); })} -
+ ); } @@ -139,7 +135,7 @@ export default function MenuButton({ ); return ( -
+
+ ); } diff --git a/src/component/elements/ToggleButton.tsx b/src/component/elements/ToggleButton.tsx index af47861f04..99b8a87690 100644 --- a/src/component/elements/ToggleButton.tsx +++ b/src/component/elements/ToggleButton.tsx @@ -1,11 +1,10 @@ -/** @jsxImportSource @emotion/react */ -import { css } from '@emotion/react'; +import styled from '@emotion/styled'; import type { CSSProperties, ReactNode } from 'react'; import { memo, useCallback, useState } from 'react'; import ToolTip from './ToolTip/ToolTip.js'; -const styles = css` +const Button = styled.button` background-color: #f5f5f5; border: none; border-radius: 5px; @@ -52,16 +51,15 @@ function ToggleButton({ }, [onClick, flag]); return ( - + ); } diff --git a/src/component/elements/ToolbarPopoverItem.tsx b/src/component/elements/ToolbarPopoverItem.tsx index 2bd9e18a4d..72b32ce522 100644 --- a/src/component/elements/ToolbarPopoverItem.tsx +++ b/src/component/elements/ToolbarPopoverItem.tsx @@ -1,7 +1,7 @@ import type { MenuItemProps } from '@blueprintjs/core'; import { Menu, MenuItem } from '@blueprintjs/core'; import type { - ToolbarPopoverItemProps as BaseToolbarPopoverItemProps, + ToolbarPopoverItemProps, ToolbarItemProps, } from 'react-science/ui'; import { Toolbar } from 'react-science/ui'; @@ -10,11 +10,8 @@ export interface ToolbarPopoverMenuItem extends MenuItemProps { data?: T; } -interface ToolbarPopoverItemProps - extends Omit< - BaseToolbarPopoverItemProps, - 'onClick' | 'content' | 'itemProps' - >, +interface CustomToolbarPopoverItemProps + extends Omit, Pick< ToolbarItemProps, 'tooltip' | 'icon' | 'tooltipProps' | 'active' | 'id' @@ -25,7 +22,7 @@ interface ToolbarPopoverItemProps } export function ToolbarPopoverItem( - props: ToolbarPopoverItemProps, + props: CustomToolbarPopoverItemProps, ) { const { options, diff --git a/src/component/elements/dropDownButton/DropDownButton.tsx b/src/component/elements/dropDownButton/DropDownButton.tsx index 083ae00422..d75d538e45 100644 --- a/src/component/elements/dropDownButton/DropDownButton.tsx +++ b/src/component/elements/dropDownButton/DropDownButton.tsx @@ -1,12 +1,15 @@ -/** @jsxImportSource @emotion/react */ import { Popover, Button } from '@blueprintjs/core'; -import { css } from '@emotion/react'; +import styled from '@emotion/styled'; import type { CSSProperties, ReactNode } from 'react'; import { useEffect, useState } from 'react'; import { FaEllipsisH } from 'react-icons/fa'; import DropDownList from './DropDownList.js'; +const PopoverButton = styled(Button)` + border: 0.55px solid lightgray; + border-radius: 5px; +`; export interface DropDownListItem { key: string; label: string; @@ -80,17 +83,13 @@ function DropDownButton( /> } > - + ); } diff --git a/src/component/elements/dropDownButton/DropDownList.tsx b/src/component/elements/dropDownButton/DropDownList.tsx index cf104b6bc1..8b21c629f8 100644 --- a/src/component/elements/dropDownButton/DropDownList.tsx +++ b/src/component/elements/dropDownButton/DropDownList.tsx @@ -1,5 +1,4 @@ -/** @jsxImportSource @emotion/react */ -import { css } from '@emotion/react'; +import styled from '@emotion/styled'; import type { DropDownListItem, @@ -7,31 +6,30 @@ import type { ItemProps, } from './DropDownButton.js'; -const styles = { - ul: css` - list-style-type: none; - padding: 0; - margin: 0; - `, - li: css` - text-align: center; - white-space: nowrap; - color: black; - border-bottom: 0.55px solid #f9f9f9; +const Menu = styled.ul` + list-style-type: none; + padding: 0; + margin: 0; +`; +const MenuItem = styled.li` + text-align: center; + white-space: nowrap; + color: black; + border-bottom: 0.55px solid #f9f9f9; - &:last-of-type { - border-bottom: none; - } + &:last-of-type { + border-bottom: none; + } - &:hover { - background-color: #f6f6f6; - } - `, - label: css` - padding: 5px 20px; - display: block; - `, -}; + &:hover { + background-color: #f6f6f6; + } +`; + +const Text = styled.span` + padding: 5px 20px; + display: block; +`; interface InnerDropDownListProps extends DropDownListProps, @@ -49,10 +47,9 @@ function DropDownList({ }: InnerDropDownListProps) { return (
-
    + {data.map((item, index) => ( -
  • { e.stopPropagation(); @@ -64,12 +61,10 @@ function DropDownList({ cursor: 'pointer', }} > - {renderItem?.(item) || ( - {item[labelKey]} - )} -
  • + {renderItem?.(item) || {item[labelKey]}} + ))} -
+
); } diff --git a/src/component/elements/export/ExportOptionsModal.tsx b/src/component/elements/export/ExportOptionsModal.tsx index 254e056d30..e243529df3 100644 --- a/src/component/elements/export/ExportOptionsModal.tsx +++ b/src/component/elements/export/ExportOptionsModal.tsx @@ -1,15 +1,12 @@ -/** @jsxImportSource @emotion/react */ import { Button, Dialog, - DialogBody, DialogFooter, Radio, RadioGroup, SegmentedControl, Tag, } from '@blueprintjs/core'; -import { css } from '@emotion/react'; import { yupResolver } from '@hookform/resolvers/yup'; import type { AdvanceExportSettings, @@ -25,6 +22,7 @@ import type { LabelStyle } from '../Label.js'; import Label from '../Label.js'; import { NumberInput2Controller } from '../NumberInput2Controller.js'; import { Select2Controller } from '../Select2Controller.js'; +import { StyledDialogBody } from '../StyledDialogBody.js'; import type { SizeItem } from '../print/pageSize.js'; import { getSizesList } from '../print/pageSize.js'; @@ -160,11 +158,7 @@ function InnerExportOptionsModal(props: InnerExportOptionsModalProps) { canEscapeKeyClose autoFocus > - +
- +
- + @@ -388,7 +382,7 @@ function InnerPrintOptionsModal(props: InnerPrintOptionsModalProps) { rightElement={cm} /> - + = { }, }; -const styles = { - container: css` - &:hover { - rect:last-child { - fill: red !important; - } +const Group = styled.g` + &:hover { + rect:last-child { + fill: red !important; } - `, -}; + } +`; export interface Position { x1: number; @@ -79,14 +76,13 @@ function SVGResizerHandle(props: { position: number; }) { return ( - - + ); } diff --git a/src/component/header/Header.tsx b/src/component/header/Header.tsx index 886c01f296..5a4c9337fc 100644 --- a/src/component/header/Header.tsx +++ b/src/component/header/Header.tsx @@ -1,5 +1,4 @@ -/** @jsxImportSource @emotion/react */ -import { css } from '@emotion/react'; +import styled from '@emotion/styled'; import { memo, useMemo } from 'react'; import { FaFilm, @@ -55,7 +54,7 @@ export const headerLabelStyle: LabelStyle = { }, }; -const styles = css` +const Container = styled.div` container-type: inline-size; z-index: 1; @@ -144,7 +143,7 @@ function HeaderInner(props: HeaderInnerProps) { } return ( -
+ @@ -213,7 +212,7 @@ function HeaderInner(props: HeaderInnerProps) {
-
+ ); } diff --git a/src/component/hooks/useSaveSettings.tsx b/src/component/hooks/useSaveSettings.tsx index edfee1c82d..f16693bbc1 100644 --- a/src/component/hooks/useSaveSettings.tsx +++ b/src/component/hooks/useSaveSettings.tsx @@ -1,4 +1,3 @@ -/** @jsxImportSource @emotion/react */ import { Dialog, DialogBody, DialogFooter } from '@blueprintjs/core'; import styled from '@emotion/styled'; import { yupResolver } from '@hookform/resolvers/yup'; diff --git a/src/component/loader/DefaultSpinnerComponent.tsx b/src/component/loader/DefaultSpinnerComponent.tsx index ad76c976ed..3056ba9e56 100644 --- a/src/component/loader/DefaultSpinnerComponent.tsx +++ b/src/component/loader/DefaultSpinnerComponent.tsx @@ -1,7 +1,6 @@ -/** @jsxImportSource @emotion/react */ -import { css } from '@emotion/react'; +import styled from '@emotion/styled'; -const styles = css` +const Container = styled.div` display: flex; align-items: center; justify-content: center; @@ -38,7 +37,7 @@ export default function DefaultSpinnerComponent({ loadingText = 'Loading ...', }) { return ( -
+ @@ -46,6 +45,6 @@ export default function DefaultSpinnerComponent({

{loadingText}

-
+ ); } diff --git a/src/component/loader/DropZone.tsx b/src/component/loader/DropZone.tsx index 5b0cbc7e29..e1fbc5b4fe 100644 --- a/src/component/loader/DropZone.tsx +++ b/src/component/loader/DropZone.tsx @@ -1,5 +1,4 @@ -/** @jsxImportSource @emotion/react */ -import { css } from '@emotion/react'; +import styled from '@emotion/styled'; import type { ReactNode } from 'react'; import { useCallback, useState } from 'react'; import * as dropzone from 'react-dropzone'; @@ -12,7 +11,7 @@ import { MetaImportationModal } from '../modal/metaImportation/MetaImportationMo import { useLoadFiles } from './useLoadFiles.js'; -const style = css` +const DropContainer = styled.div` height: 100%; background-color: #b5b5b599; position: absolute; @@ -22,14 +21,6 @@ const style = css` flex-flow: column; z-index: 8; - p { - color: white; - background-color: rgb(104 104 104); - padding: 1.5%; - border-radius: 30px; - margin: 0; - } - svg { stroke-width: 0; font-size: 3rem !important; @@ -37,7 +28,15 @@ const style = css` } `; -const containerStyle = css` +const DropText = styled.p` + color: white; + background-color: rgb(104 104 104); + padding: 1.5%; + border-radius: 30px; + margin: 0; +`; + +const Container = styled.div` display: flex; height: 100%; `; @@ -83,11 +82,10 @@ export default function DropZone(props: DropZoneProps) { onCloseDialog={() => openMetaInformationDialog(null)} /> )} -
+ {isDragActive && ( -
-

Drop your files here

-
+ Drop your files here + )} {props.children} -
+ ); } diff --git a/src/component/modal/AboutPredictionModal.tsx b/src/component/modal/AboutPredictionModal.tsx index 23acee7844..5c1267ba61 100644 --- a/src/component/modal/AboutPredictionModal.tsx +++ b/src/component/modal/AboutPredictionModal.tsx @@ -1,12 +1,11 @@ -/** @jsxImportSource @emotion/react */ -import { Dialog, DialogBody } from '@blueprintjs/core'; -import { css } from '@emotion/react'; +import { Dialog } from '@blueprintjs/core'; +import styled from '@emotion/styled'; import { FaInfo } from 'react-icons/fa'; import { Toolbar, useOnOff } from 'react-science/ui'; -const styles = css` - background-color: white; +import { StyledDialogBody } from '../elements/StyledDialogBody.js'; +const DialogBody = styled(StyledDialogBody)` ul { list-style-type: disc; margin-left: 25px; @@ -54,7 +53,7 @@ function AboutPredictionModal() { title="About prediction" style={{ width: '600px' }} > - +

If you are using our tools please cite us:

  • diff --git a/src/component/modal/AboutSpectrumSimulationModal.tsx b/src/component/modal/AboutSpectrumSimulationModal.tsx index 2192f54000..79e0f1e700 100644 --- a/src/component/modal/AboutSpectrumSimulationModal.tsx +++ b/src/component/modal/AboutSpectrumSimulationModal.tsx @@ -1,10 +1,11 @@ -/** @jsxImportSource @emotion/react */ -import { Dialog, DialogBody } from '@blueprintjs/core'; -import { css } from '@emotion/react'; +import { Dialog } from '@blueprintjs/core'; +import styled from '@emotion/styled'; import { FaInfo } from 'react-icons/fa'; import { Toolbar, useOnOff } from 'react-science/ui'; -const styles = css` +import { StyledDialogBody } from '../elements/StyledDialogBody.js'; + +const DialogBody = styled(StyledDialogBody)` background-color: white; ul { @@ -56,7 +57,7 @@ function AboutSpectrumSimulationModal() { title="About spectrum simulation" style={{ width: '600px' }} > - +

    If you are using our tools please cite us:

    • diff --git a/src/component/modal/CopyClipboardModal.tsx b/src/component/modal/CopyClipboardModal.tsx index e2596aa718..e521463fc1 100644 --- a/src/component/modal/CopyClipboardModal.tsx +++ b/src/component/modal/CopyClipboardModal.tsx @@ -1,9 +1,9 @@ -/** @jsxImportSource @emotion/react */ -import { Button, Dialog, DialogBody, DialogFooter } from '@blueprintjs/core'; -import { css } from '@emotion/react'; +import { Button, Dialog, DialogFooter } from '@blueprintjs/core'; import styled from '@emotion/styled'; import { FaCopy } from 'react-icons/fa'; +import { StyledDialogBody } from '../elements/StyledDialogBody.js'; + const Body = styled.div` padding: 5px; width: 100%; @@ -30,13 +30,9 @@ function InnerCopyClipboardModal(props: Required) { const { text, title, onClose, onCopyClick } = props; return ( - + - + ); diff --git a/src/component/modal/changeSum/ChangeSumModalContents.tsx b/src/component/modal/changeSum/ChangeSumModalContents.tsx index e87a64dffa..ae272a325e 100644 --- a/src/component/modal/changeSum/ChangeSumModalContents.tsx +++ b/src/component/modal/changeSum/ChangeSumModalContents.tsx @@ -1,6 +1,4 @@ -/** @jsxImportSource @emotion/react */ -import { Button, DialogBody, DialogFooter, Tab, Tabs } from '@blueprintjs/core'; -import { css } from '@emotion/react'; +import { Button, DialogFooter, Tab, Tabs } from '@blueprintjs/core'; import styled from '@emotion/styled'; import { yupResolver } from '@hookform/resolvers/yup'; import type { SumOptions } from 'nmr-load-save'; @@ -10,9 +8,16 @@ import * as Yup from 'yup'; import { usePreferences } from '../../context/PreferencesContext.js'; import { NumberInput2Controller } from '../../elements/NumberInput2Controller.js'; +import { StyledDialogBody } from '../../elements/StyledDialogBody.js'; import SelectMolecule from './SelectMolecule.js'; +const DialogBody = styled(StyledDialogBody)` + [role='tablist'] { + border-bottom: 1px solid #f0f0f0; + } +`; + function getValidationSchema(option: SumSetOption) { if (option === 'auto') { return Yup.object({ @@ -116,16 +121,7 @@ export function ChangeSumModalContents(props: ChangeSumModalContentsProps) { return ( <> - + ` + width: 100%; + padding: 20%; + text-align: center; + color: ${({ color }) => color}; `; export default function SelectMolecule< @@ -92,27 +88,27 @@ export default function SelectMolecule< ); return ( -
      +
      {element && molecules && molecules.length > 0 ? ( -
      -

      Select a molecule as reference!

      + + Select a molecule as reference! -
      + -

      + New sum for {element} will be {newSum}! -

      -
      -
      + + + ) : ( -

      + You have to Select a spectrum and Add a molecule from the Structure panel to select as a reference! -

      + )}
      ); diff --git a/src/component/modal/editRange/EditRangeModal.tsx b/src/component/modal/editRange/EditRangeModal.tsx index 534c57b688..3d07882572 100644 --- a/src/component/modal/editRange/EditRangeModal.tsx +++ b/src/component/modal/editRange/EditRangeModal.tsx @@ -1,6 +1,6 @@ /** @jsxImportSource @emotion/react */ -import { Button, DialogBody, DialogFooter } from '@blueprintjs/core'; -import { css } from '@emotion/react'; +import { Button, DialogFooter } from '@blueprintjs/core'; +import styled from '@emotion/styled'; import { yupResolver } from '@hookform/resolvers/yup'; import { v4 } from '@lukeed/uuid'; import type { Spectrum1D } from 'nmr-load-save'; @@ -14,6 +14,7 @@ import { useChartData } from '../../context/ChartContext.js'; import { useDispatch } from '../../context/DispatchContext.js'; import type { DialogProps } from '../../elements/DialogManager.js'; import { DraggableDialog } from '../../elements/DraggableDialog.js'; +import { StyledDialogBody } from '../../elements/StyledDialogBody.js'; import { usePanelPreferences } from '../../hooks/usePanelPreferences.js'; import useSpectrum from '../../hooks/useSpectrum.js'; import useEditRangeModal from '../../panels/RangesPanel/hooks/useEditRangeModal.js'; @@ -23,9 +24,7 @@ import { formatNumber } from '../../utility/formatNumber.js'; import SignalsContent from './forms/components/SignalsContent.js'; import editRangeFormValidation from './forms/validation/EditRangeValidation.js'; -const styles = css` - background-color: white; - +const DialogBody = styled(StyledDialogBody)` .tabs .tab-list { overflow-x: auto; } @@ -197,7 +196,7 @@ function InnerEditRangeModal(props: InnerEditRangeModalProps) { onClose={handleOnClose} placement="top-right" > - + diff --git a/src/component/modal/editRange/forms/components/SignalTab.tsx b/src/component/modal/editRange/forms/components/SignalTab.tsx index b564c15afc..810ed50ddd 100644 --- a/src/component/modal/editRange/forms/components/SignalTab.tsx +++ b/src/component/modal/editRange/forms/components/SignalTab.tsx @@ -1,6 +1,5 @@ -/** @jsxImportSource @emotion/react */ import { Tab, Tabs } from '@blueprintjs/core'; -import { css } from '@emotion/react'; +import styled from '@emotion/styled'; import type { CSSProperties } from 'react'; import { memo } from 'react'; @@ -21,16 +20,15 @@ interface SignalTabProps { index: number; } +const Container = styled.div` + div[role='tabpanel'] { + width: 100%; + } +`; + function SignalTab({ index }: SignalTabProps) { return ( -
      + } /> -
      + ); } diff --git a/src/component/modal/editZone/EditZoneModal.tsx b/src/component/modal/editZone/EditZoneModal.tsx index e62f84d4f8..ef187c0f3d 100644 --- a/src/component/modal/editZone/EditZoneModal.tsx +++ b/src/component/modal/editZone/EditZoneModal.tsx @@ -1,6 +1,4 @@ -/** @jsxImportSource @emotion/react */ -import { Button, DialogBody, DialogFooter } from '@blueprintjs/core'; -import { css } from '@emotion/react'; +import { Button, DialogFooter } from '@blueprintjs/core'; import { yupResolver } from '@hookform/resolvers/yup'; import type { FromTo } from 'cheminfo-types'; import type { Signal2D } from 'nmr-processing'; @@ -11,6 +9,7 @@ import * as Yup from 'yup'; import DefaultPathLengths from '../../../data/constants/DefaultPathLengths.js'; import type { DialogProps } from '../../elements/DialogManager.js'; import { DraggableDialog } from '../../elements/DraggableDialog.js'; +import { StyledDialogBody } from '../../elements/StyledDialogBody.js'; import type { ZoneData } from '../../panels/ZonesPanel/hooks/useMapZones.js'; import { useZoneActions } from '../../panels/ZonesPanel/hooks/useZoneActions.js'; @@ -86,15 +85,11 @@ export function EditZoneModal(props: DialogProps) { onClose={onCloseDialog} placement="top-right" > - + - +
      - +
      - + } /> } /> @@ -306,9 +296,9 @@ function InnerGeneralSettingsModal(props: InnerGeneralSettingsModalProps) { id="export-options" panel={} /> - +
      -
      + @@ -389,14 +379,14 @@ function WorkSpaceActionsButtons(props) { > - + +
); } diff --git a/src/component/modal/setting/settings-tabs/DatabasesTabContent.tsx b/src/component/modal/setting/settings-tabs/DatabasesTabContent.tsx index 82bb1ab648..db94e2b7f3 100644 --- a/src/component/modal/setting/settings-tabs/DatabasesTabContent.tsx +++ b/src/component/modal/setting/settings-tabs/DatabasesTabContent.tsx @@ -1,6 +1,5 @@ -/** @jsxImportSource @emotion/react */ import { Checkbox, Classes, Radio } from '@blueprintjs/core'; -import { css } from '@emotion/react'; +import styled from '@emotion/styled'; import { v4 } from '@lukeed/uuid'; import type { CustomWorkspaces, Database } from 'nmr-load-save'; import { useCallback, useMemo } from 'react'; @@ -18,6 +17,10 @@ import { getPreferencesByWorkspace } from '../../../reducer/preferences/utilitie import { isGoogleDocument } from '../../../utility/isGoogleDocument.js'; import { Section } from '../GeneralSettings.js'; +const StyledButton = styled(Button)<{ marginHorizontal: number }>` + margin: 0 ${({ marginHorizontal }) => marginHorizontal}px; +`; + function getKeyPath( index: number, key: T, @@ -158,18 +161,16 @@ function DatabasesTabContent({ > - + {isGoogleDocument(record.url) && ( )} - + )} ); diff --git a/src/component/panels/SpectraPanel/SpectraTabs.tsx b/src/component/panels/SpectraPanel/SpectraTabs.tsx index 5729bf9771..1eb47e593b 100644 --- a/src/component/panels/SpectraPanel/SpectraTabs.tsx +++ b/src/component/panels/SpectraPanel/SpectraTabs.tsx @@ -1,5 +1,4 @@ -/** @jsxImportSource @emotion/react */ -import { css } from '@emotion/react'; +import styled from '@emotion/styled'; import type { ActiveSpectrum, Spectrum } from 'nmr-load-save'; import { memo, useCallback, useMemo, useState } from 'react'; @@ -14,6 +13,13 @@ import groupByInfoKey from '../../utility/GroupByInfoKey.js'; import { SpectraTable } from './SpectraTable.js'; import SpectrumSetting from './base/setting/SpectrumSetting.js'; +const Container = styled.div` + height: calc(100% - 25px); + + tbody tr { + height: 20px; + } +`; interface SpectraTabsInnerProps { spectra: Spectrum[]; activeTab: string; @@ -76,14 +82,7 @@ function SpectraTabsInner({ } return ( -
+ {spectraGroupByNucleus && Object.keys(spectraGroupByNucleus).map((nucleus) => ( @@ -112,7 +111,7 @@ function SpectraTabsInner({ position={settingModalPosition} /> ) : null} -
+ ); } diff --git a/src/component/panels/SpectraPanel/base/setting/Spectrum2DSetting.tsx b/src/component/panels/SpectraPanel/base/setting/Spectrum2DSetting.tsx index c2f522ac38..055bb49b3a 100644 --- a/src/component/panels/SpectraPanel/base/setting/Spectrum2DSetting.tsx +++ b/src/component/panels/SpectraPanel/base/setting/Spectrum2DSetting.tsx @@ -1,8 +1,8 @@ -/** @jsxImportSource @emotion/react */ import { RangeSlider } from '@blueprintjs/core'; -import { css } from '@emotion/react'; +import styled from '@emotion/styled'; import debounce from 'lodash/debounce.js'; import { useMemo } from 'react'; +import type { CSSProperties } from 'react'; import { Controller, FormProvider, @@ -19,19 +19,27 @@ import { colorToHexWithAlpha } from '../../../../utility/colorToHexWithAlpha.js' import Spectrum2DHistogram from './Spectrum2DHistogram.js'; +const StyledRangeSlider = styled(RangeSlider)<{ + progressColor: CSSProperties['backgroundColor']; +}>` + width: 90%; + + [class*='slider-progress']:nth-child(2) { + background-color: ${(props) => props.progressColor}; + } +`; interface Spectrum2DSettingProps { data: any; onSubmit: (values: any) => void; } -const style = (color: string) => css` +const Container = styled.div<{ color: CSSProperties['backgroundColor'] }>` display: inline-block; .track-1 { - background-color: ${color} !important; + background-color: ${(props) => props.color} !important; } `; - function Spectrum2DSetting({ data: SpectrumData, onSubmit, @@ -42,14 +50,14 @@ function Spectrum2DSetting({ return (
-
+ Positive -
-
+ + Negative -
+
@@ -105,7 +113,7 @@ function Settings(props: SettingsProps) { const { value, onChange } = field; return ( - ); }} diff --git a/src/component/panels/SpectraPanel/base/setting/SpectrumSetting.tsx b/src/component/panels/SpectraPanel/base/setting/SpectrumSetting.tsx index b0f25d4bb7..e9ddf6becf 100644 --- a/src/component/panels/SpectraPanel/base/setting/SpectrumSetting.tsx +++ b/src/component/panels/SpectraPanel/base/setting/SpectrumSetting.tsx @@ -1,5 +1,4 @@ -/** @jsxImportSource @emotion/react */ -import { css } from '@emotion/react'; +import styled from '@emotion/styled'; import { memo, useCallback } from 'react'; import { useDispatch } from '../../../../context/DispatchContext.js'; @@ -7,7 +6,7 @@ import { useDispatch } from '../../../../context/DispatchContext.js'; import Spectrum1DSetting from './Spectrum1DSetting.js'; import Spectrum2DSetting from './Spectrum2DSetting.js'; -const style = css` +const Container = styled.div` position: fixed; z-index: 999999999; width: 100%; @@ -101,7 +100,7 @@ function SpectrumSetting({ position, data, onClose }: SpectrumSettingProps) { const { x, y } = position; return ( -
+
)}
-
+ ); } diff --git a/src/component/panels/SummaryPanel/CorrelationTable/CorrelationTable.tsx b/src/component/panels/SummaryPanel/CorrelationTable/CorrelationTable.tsx index 67d4f53438..32a01a9f12 100644 --- a/src/component/panels/SummaryPanel/CorrelationTable/CorrelationTable.tsx +++ b/src/component/panels/SummaryPanel/CorrelationTable/CorrelationTable.tsx @@ -1,5 +1,4 @@ -/** @jsxImportSource @emotion/react */ -import { css } from '@emotion/react'; +import styled from '@emotion/styled'; import type { Correlation } from 'nmr-correlation'; import { useMemo } from 'react'; @@ -8,7 +7,7 @@ import { getLabelColor } from '../utilities/Utilities.js'; import AdditionalColumnHeader from './AdditionalColumnHeader.js'; import CorrelationTableRow from './CorrelationTableRow.js'; -const tableStyle = css` +const Container = styled.div` overflow: auto; height: 100%; display: block; @@ -131,7 +130,7 @@ function CorrelationTable({ ); return ( -
+ @@ -145,7 +144,7 @@ function CorrelationTable({ {rows}
-
+ ); } diff --git a/src/component/panels/SummaryPanel/CorrelationTable/editLink/Confirmation.tsx b/src/component/panels/SummaryPanel/CorrelationTable/editLink/Confirmation.tsx index e4f35bad31..31fb527865 100644 --- a/src/component/panels/SummaryPanel/CorrelationTable/editLink/Confirmation.tsx +++ b/src/component/panels/SummaryPanel/CorrelationTable/editLink/Confirmation.tsx @@ -1,8 +1,7 @@ -/** @jsxImportSource @emotion/react */ -import { css } from '@emotion/react'; +import styled from '@emotion/styled'; import { useCallback } from 'react'; -const styles = css` +const Container = styled.div` margin-top: 10px; padding: 5px; text-align: center; @@ -50,12 +49,12 @@ function EditLinkConfirmation({ ); return ( -
+

{description}

-
+ ); } diff --git a/src/component/panels/SummaryPanel/CorrelationTable/editLink/EditPathLength.tsx b/src/component/panels/SummaryPanel/CorrelationTable/editLink/EditPathLength.tsx index 1ebe1b8297..239d5b1530 100644 --- a/src/component/panels/SummaryPanel/CorrelationTable/editLink/EditPathLength.tsx +++ b/src/component/panels/SummaryPanel/CorrelationTable/editLink/EditPathLength.tsx @@ -1,5 +1,4 @@ -/** @jsxImportSource @emotion/react */ -import { css } from '@emotion/react'; +import styled from '@emotion/styled'; import type { FromTo } from 'cheminfo-types'; import type { Signal2D } from 'nmr-processing'; import { useCallback, useEffect, useState } from 'react'; @@ -9,22 +8,12 @@ import Button from '../../../../elements/Button.js'; import Input from '../../../../elements/Input.js'; import Label from '../../../../elements/Label.js'; -const editPathLengthsStyles = css` +const Container = styled.div` width: 100%; height: 100%; margin-top: 10px; text-align: center; - .input-container { - width: 100%; - margin-top: 5px; - text-align: center; - display: flex; - flex-direction: column; - align-items: center; - justify-content: center; - } - button { flex: 2; padding: 5px; @@ -38,11 +27,20 @@ const editPathLengthsStyles = css` color: white; background-color: gray; } +`; - .warning { - margin-top: 5px; - color: red; - } +const InputContainer = styled.div` + width: 100%; + margin-top: 5px; + text-align: center; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; +`; +const WarningText = styled.span` + margin-top: 5px; + color: red; `; interface InputProps { @@ -85,9 +83,9 @@ function EditPathLength({ signal, experimentType, onEdit }: InputProps) { }, [to, from]); return ( -
+

Setting of the minimum and maximum path length (J coupling).

-
+ -
+ {isError ? ( -

+ Minimum must not be 0 or higher than the maximum value.{' '} -

+ ) : ( )} -
+ ); } diff --git a/src/component/panels/SummaryPanel/CorrelationTable/editLink/MoveLink.tsx b/src/component/panels/SummaryPanel/CorrelationTable/editLink/MoveLink.tsx index 00d5626c29..6f080fd2d6 100644 --- a/src/component/panels/SummaryPanel/CorrelationTable/editLink/MoveLink.tsx +++ b/src/component/panels/SummaryPanel/CorrelationTable/editLink/MoveLink.tsx @@ -1,12 +1,11 @@ -/** @jsxImportSource @emotion/react */ -import { css } from '@emotion/react'; +import styled from '@emotion/styled'; import type { Correlation, Link } from 'nmr-correlation'; import { getCorrelationDelta } from 'nmr-correlation'; import { useCallback, useState } from 'react'; import Select from '../../../../elements/Select.js'; -const moveLinkStyles = css` +const Container = styled.div` width: 100%; height: 100%; margin-top: 10px; @@ -119,7 +118,7 @@ function MoveLink({ ); return ( -
+

Move of signals on either one or both axes.

"New" means to separate into a new row or column.

@@ -134,7 +133,7 @@ function MoveLink({ > Move -
+
); } diff --git a/src/component/panels/SummaryPanel/Overview.tsx b/src/component/panels/SummaryPanel/Overview.tsx index af0dc12a71..00bcf1c356 100644 --- a/src/component/panels/SummaryPanel/Overview.tsx +++ b/src/component/panels/SummaryPanel/Overview.tsx @@ -1,11 +1,10 @@ -/** @jsxImportSource @emotion/react */ -import { css } from '@emotion/react'; +import styled from '@emotion/styled'; import { getAtomCounts } from 'nmr-correlation'; import { memo } from 'react'; import { ErrorColors, Errors } from './CorrelationTable/Constants.js'; -const styles = css` +const Container = styled.div` display: flex; width: 100%; font-size: 15px; @@ -69,7 +68,7 @@ function Overview({ correlationsData }: OverviewProps) {

); - return
{elements}
; + return {elements}; } export default memo(Overview); diff --git a/src/component/panels/SummaryPanel/SummaryPanel.tsx b/src/component/panels/SummaryPanel/SummaryPanel.tsx index bfaa0b21e4..ab5ddad808 100644 --- a/src/component/panels/SummaryPanel/SummaryPanel.tsx +++ b/src/component/panels/SummaryPanel/SummaryPanel.tsx @@ -1,5 +1,4 @@ -/** @jsxImportSource @emotion/react */ -import { css } from '@emotion/react'; +import styled from '@emotion/styled'; import type { Correlation, Link, @@ -51,38 +50,37 @@ export type OnEditCorrelationCallback = ( options?: CorrelationOptions, ) => void; -const panelStyle = css` +const Container = styled.div` display: flex; flex-direction: column; text-align: center; height: 100%; width: 100%; +`; - .extra-header-content { - display: flex; - flex: 1; - justify-content: center; - - .overview-container { - width: 100%; - display: flex; - align-items: center; - margin-left: 10px; - } +const InnerHeader = styled.div` + display: flex; + flex: 1; + justify-content: center; +`; +const OverviewContainer = styled.div` + width: 100%; + display: flex; + align-items: center; + margin-left: 10px; +`; - .table-view-selection { - width: 100%; - display: flex; - align-items: center; - justify-content: flex-end; - margin-right: 2px; - white-space: nowrap; +const SelectionContainer = styled.div` + width: 100%; + display: flex; + align-items: center; + justify-content: flex-end; + margin-right: 2px; + white-space: nowrap; +`; - label { - font-size: 13px; - } - } - } +const SelectionLabel = styled.label` + font-size: 13px; `; const EditLinkDialog = withDialog(EditLinkModal); @@ -474,7 +472,7 @@ function SummaryPanel() { const total = correlationsData ? correlationsData.values.length : 0; return ( -
+ -
-
+ + -
-
+ + - + View: