Skip to content

Commit

Permalink
refactor: enhance styling of StepInput
Browse files Browse the repository at this point in the history
  • Loading branch information
KaiVolland committed Jun 19, 2024
1 parent ff20dad commit e84536a
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 10 deletions.
18 changes: 11 additions & 7 deletions src/Component/FunctionUI/FunctionUI.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import BooleanExpressionInput from '../ExpressionInput/BooleanExpressionInput/Bo
import { FunctionConfig, functionConfigs } from './functionConfigs';
import CaseInput from './CaseInput/CaseInput';
import UnknownInput from './UnknownInput/UnknownInput';
import StepInput from './SetpInput/StepInput';
import StepInput from './StepInput/StepInput';

type Type = 'string' | 'number' | 'boolean' | 'unknown';

Expand Down Expand Up @@ -118,12 +118,16 @@ export const FunctionUI = <T extends GeoStylerFunction>({
);
}
if (cfg.type === 'unknown') {
return <UnknownInput
value={functionArgs?.[index]}
onChange={(val) => {
updateFunctionArg(val, index);
}}
/>;
return (
<div className='gs-function-arg' key={`${key}${index}`}>
<i className='tree-icon' /><UnknownInput
value={functionArgs?.[index]}
onChange={(val) => {
updateFunctionArg(val, index);
}}
/>
</div>
);
}

if (isGeoStylerFunction(functionArgs?.[index])) {
Expand Down
Empty file.
7 changes: 7 additions & 0 deletions src/Component/FunctionUI/StepInput/StepInput.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.gs-step-input {
display: flex;

.number-expression-input {
flex: 1;
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React, { useCallback } from 'react';
import { Expression, FStepParameter } from 'geostyler-style';
import { Input } from 'antd';
import './StepInput.less';
import NumberExpressionInput from '../../ExpressionInput/NumberExpressionInput/NumberExpressionInput';
import UnknownInput from '../UnknownInput/UnknownInput';

export type StepInputProps = {
value?: FStepParameter;
Expand All @@ -29,13 +29,13 @@ export const StepInput: React.FC<StepInputProps> = ({
}, [value, onChange]);

return (
<div className="gs-boundary-input">
<div className="gs-step-input">
<NumberExpressionInput
onChange={onBoundaryChante}
onCancel={() => onChange(undefined)}
value={value?.boundary}
/>
<Input
<UnknownInput
onChange={onValueChange}
value={value?.value as any}
/>
Expand Down

0 comments on commit e84536a

Please sign in to comment.