-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor
Selector
API and implement ComplexVisTypeSelector
- Loading branch information
Showing
19 changed files
with
134 additions
and
127 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
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
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
This file was deleted.
Oops, something went wrong.
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
24 changes: 24 additions & 0 deletions
24
packages/lib/src/toolbar/controls/ColorMapSelector/ColorMapGradient.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,24 @@ | ||
import { INTERPOLATORS } from '../../../vis/heatmap/interpolators'; | ||
import type { ColorMap } from '../../../vis/heatmap/models'; | ||
import { getLinearGradient } from '../../../vis/heatmap/utils'; | ||
import styles from './ColorMapSelector.module.css'; | ||
|
||
interface Props { | ||
colorMap: ColorMap; | ||
} | ||
|
||
function ColorMapGradient(props: Props) { | ||
const { colorMap } = props; | ||
|
||
return ( | ||
<div | ||
className={styles.gradient} | ||
style={{ | ||
backgroundImage: getLinearGradient(INTERPOLATORS[colorMap], 'right'), | ||
}} | ||
data-keep-colors | ||
/> | ||
); | ||
} | ||
|
||
export default ColorMapGradient; |
26 changes: 0 additions & 26 deletions
26
packages/lib/src/toolbar/controls/ColorMapSelector/ColorMapOption.tsx
This file was deleted.
Oops, something went wrong.
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
32 changes: 32 additions & 0 deletions
32
packages/lib/src/toolbar/controls/ComplexVisTypeSelector.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,32 @@ | ||
import { ComplexVisType } from '@h5web/shared/vis-models'; | ||
|
||
import Selector from './Selector/Selector'; | ||
|
||
const VIS_TYPE_OPTIONS = { | ||
[ComplexVisType.Phase]: 'φ Phase', | ||
[ComplexVisType.Amplitude]: '𝓐 Amplitude', | ||
[ComplexVisType.PhaseAmplitude]: 'φ𝓐 Phase & Amp.', | ||
} satisfies Record<ComplexVisType, string>; | ||
|
||
interface Props<T extends ComplexVisType> { | ||
label?: string; | ||
value: T; | ||
onChange: (scale: T) => void; | ||
options: T[]; | ||
} | ||
|
||
function ComplexVisTypeSelector<T extends ComplexVisType>(props: Props<T>) { | ||
const { label, value, onChange, options } = props; | ||
|
||
return ( | ||
<Selector | ||
label={label} | ||
value={value} | ||
onChange={onChange} | ||
options={options} | ||
renderOption={(option) => VIS_TYPE_OPTIONS[option]} | ||
/> | ||
); | ||
} | ||
|
||
export default ComplexVisTypeSelector; |
33 changes: 0 additions & 33 deletions
33
packages/lib/src/toolbar/controls/ScaleSelector/ScaleOption.tsx
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.