mirror of
https://github.com/Unleash/unleash.git
synced 2025-08-13 13:48:59 +02:00
more cleanup
This commit is contained in:
parent
9904dcea37
commit
e098354e99
@ -10,20 +10,11 @@ import {
|
|||||||
import type { IConstraint } from 'interfaces/strategy';
|
import type { IConstraint } from 'interfaces/strategy';
|
||||||
import { ConstraintAccordionViewBody } from './ConstraintAccordionViewBody/ConstraintAccordionViewBody.tsx';
|
import { ConstraintAccordionViewBody } from './ConstraintAccordionViewBody/ConstraintAccordionViewBody.tsx';
|
||||||
import { ConstraintAccordionViewHeader } from './ConstraintAccordionViewHeader/ConstraintAccordionViewHeader.tsx';
|
import { ConstraintAccordionViewHeader } from './ConstraintAccordionViewHeader/ConstraintAccordionViewHeader.tsx';
|
||||||
import { oneOf } from 'utils/oneOf';
|
|
||||||
import {
|
|
||||||
dateOperators,
|
|
||||||
numOperators,
|
|
||||||
semVerOperators,
|
|
||||||
} from 'constants/operators';
|
|
||||||
|
|
||||||
interface IConstraintAccordionViewProps {
|
interface IConstraintAccordionViewProps {
|
||||||
constraint: IConstraint;
|
constraint: IConstraint;
|
||||||
onDelete?: () => void;
|
|
||||||
onEdit?: () => void;
|
|
||||||
onUse?: () => void;
|
onUse?: () => void;
|
||||||
sx?: SxProps<Theme>;
|
sx?: SxProps<Theme>;
|
||||||
compact?: boolean;
|
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
renderAfter?: JSX.Element;
|
renderAfter?: JSX.Element;
|
||||||
borderStyle?: 'solid' | 'dashed';
|
borderStyle?: 'solid' | 'dashed';
|
||||||
@ -73,11 +64,8 @@ const StyledWrapper = styled('div')({
|
|||||||
|
|
||||||
export const ConstraintAccordionView = ({
|
export const ConstraintAccordionView = ({
|
||||||
constraint,
|
constraint,
|
||||||
onEdit,
|
|
||||||
onDelete,
|
|
||||||
onUse,
|
onUse,
|
||||||
sx = undefined,
|
sx = undefined,
|
||||||
compact = false,
|
|
||||||
disabled = false,
|
disabled = false,
|
||||||
renderAfter,
|
renderAfter,
|
||||||
borderStyle = 'solid',
|
borderStyle = 'solid',
|
||||||
@ -85,10 +73,6 @@ export const ConstraintAccordionView = ({
|
|||||||
const [expandable, setExpandable] = useState(true);
|
const [expandable, setExpandable] = useState(true);
|
||||||
const [expanded, setExpanded] = useState(false);
|
const [expanded, setExpanded] = useState(false);
|
||||||
|
|
||||||
const singleValue = oneOf(
|
|
||||||
[...semVerOperators, ...numOperators, ...dateOperators],
|
|
||||||
constraint.operator,
|
|
||||||
);
|
|
||||||
const handleClick = () => {
|
const handleClick = () => {
|
||||||
if (expandable) {
|
if (expandable) {
|
||||||
setExpanded(!expanded);
|
setExpanded(!expanded);
|
||||||
@ -111,8 +95,6 @@ export const ConstraintAccordionView = ({
|
|||||||
<StyledWrapper>
|
<StyledWrapper>
|
||||||
<ConstraintAccordionViewHeader
|
<ConstraintAccordionViewHeader
|
||||||
constraint={constraint}
|
constraint={constraint}
|
||||||
onEdit={onEdit}
|
|
||||||
onDelete={onDelete}
|
|
||||||
onUse={onUse}
|
onUse={onUse}
|
||||||
allowExpand={setExpandable}
|
allowExpand={setExpandable}
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
|
Loading…
Reference in New Issue
Block a user