Skip to content

Commit

Permalink
fix(FOROME-1626): numeric condition strictness signs
Browse files Browse the repository at this point in the history
  • Loading branch information
Lapk1n authored Sep 6, 2022
1 parent 51c12a2 commit ecc7bad
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 18 deletions.
3 changes: 0 additions & 3 deletions src/components/conditions/numeric/numeric-condition-range.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React, { ReactElement, useCallback, useMemo, useState } from 'react'
import cn from 'classnames'

import { NumericSelectTypes } from '@core/enum/numeric-select-types-enum'
import { adjustHistogramData } from '@core/histograms'
import { t } from '@i18n'
import { Checkbox } from '@ui/checkbox/checkbox'
Expand Down Expand Up @@ -123,7 +122,6 @@ export const NumericConditionRange = ({
<div className="grow-0 mx-2">
<StrictnessSelect
value={minStrictness}
selectType={NumericSelectTypes.Min}
onChange={v => updateValue(NumericValueIndex.MinStrictness, v)}
isDisabled={isZeroIncluded}
/>
Expand All @@ -140,7 +138,6 @@ export const NumericConditionRange = ({
<div className="grow-0 mx-2">
<StrictnessSelect
value={maxStrictness}
selectType={NumericSelectTypes.Max}
onChange={v => updateValue(NumericValueIndex.MaxStrictness, v)}
/>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,29 +1,23 @@
import { ReactElement, useMemo } from 'react'
import cn from 'classnames'

import { NumericSelectTypes } from '@core/enum/numeric-select-types-enum'
import { Icon } from '@ui/icon'

interface IStrictnessSelectButtonProps {
value: boolean
selectType: NumericSelectTypes
onChange: (newValue: boolean) => void
disabled?: boolean
}

export const StrictnessSelectButton = ({
disabled,
value,
selectType,
onChange,
}: IStrictnessSelectButtonProps): ReactElement => {
const strictnessSign = useMemo(() => {
return value ? <Icon name="LessOrEqualThan" /> : <Icon name="LessThan" />
}, [value])

const signDirection =
selectType === NumericSelectTypes.Min ? 'scale(-1,1)' : ''

return (
<button
className={cn(
Expand All @@ -35,7 +29,6 @@ export const StrictnessSelectButton = ({
onClick={() => onChange(value ? false : true)}
>
<div
style={{ transform: signDirection }}
className={cn(
'flex items-center justify-center w-full h-full rounded',
disabled
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,21 @@
import { ReactElement } from 'react'

import { NumericSelectTypes } from '@core/enum/numeric-select-types-enum'
import { StrictnessSelectButton } from './strictness-select-button'

export interface IStrictnessSelectProps {
value: boolean
selectType: NumericSelectTypes
onChange: (newValue: boolean) => void
isDisabled?: boolean
}

export const StrictnessSelect = ({
value,
selectType,
onChange,
isDisabled,
}: IStrictnessSelectProps): ReactElement => (
<StrictnessSelectButton
value={value}
disabled={isDisabled}
selectType={selectType}
onChange={onChange}
/>
)
4 changes: 0 additions & 4 deletions src/core/enum/numeric-select-types-enum.ts

This file was deleted.

0 comments on commit ecc7bad

Please sign in to comment.