优化风格
This commit is contained in:
@@ -7,6 +7,7 @@ import {
|
||||
VISIBILITY_RULE_TARGET_LABELS,
|
||||
} from '../types';
|
||||
import { visibilityOperatorNeedsValue } from '../utils';
|
||||
import { FieldSelect } from './PsSelect';
|
||||
|
||||
export interface VisibilityRuleDraft {
|
||||
target: VisibilityRuleTarget;
|
||||
@@ -32,7 +33,7 @@ export const VisibilityRuleForm: React.FC<VisibilityRuleFormProps> = ({
|
||||
<div className="space-y-3">
|
||||
<div>
|
||||
<label className="ps-field-label">条件对象</label>
|
||||
<select
|
||||
<FieldSelect
|
||||
value={target}
|
||||
onChange={(e) => {
|
||||
const nextTarget = e.target.value as VisibilityRuleTarget;
|
||||
@@ -48,12 +49,12 @@ export const VisibilityRuleForm: React.FC<VisibilityRuleFormProps> = ({
|
||||
{VISIBILITY_RULE_TARGET_LABELS[t]}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</FieldSelect>
|
||||
</div>
|
||||
{target === 'variable' ? (
|
||||
<div>
|
||||
<label className="ps-field-label">变量</label>
|
||||
<select
|
||||
<FieldSelect
|
||||
value={rule.variable}
|
||||
onChange={(e) => onChange({ variable: e.target.value })}
|
||||
className="ps-field text-[11px] w-full mt-0.5"
|
||||
@@ -64,7 +65,7 @@ export const VisibilityRuleForm: React.FC<VisibilityRuleFormProps> = ({
|
||||
{v}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</FieldSelect>
|
||||
{variableOptions.length === 0 && (
|
||||
<p className="text-[9px] text-[#666] mt-1 leading-relaxed">
|
||||
请先在「变量管理」中添加变量,或改用「内容值」作为条件对象
|
||||
@@ -78,7 +79,7 @@ export const VisibilityRuleForm: React.FC<VisibilityRuleFormProps> = ({
|
||||
)}
|
||||
<div>
|
||||
<label className="ps-field-label">条件</label>
|
||||
<select
|
||||
<FieldSelect
|
||||
value={rule.operator}
|
||||
onChange={(e) => {
|
||||
const operator = e.target.value as VisibilityOperator;
|
||||
@@ -94,7 +95,7 @@ export const VisibilityRuleForm: React.FC<VisibilityRuleFormProps> = ({
|
||||
{VISIBILITY_OPERATOR_LABELS[op]}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</FieldSelect>
|
||||
</div>
|
||||
{visibilityOperatorNeedsValue(rule.operator) && (
|
||||
<div>
|
||||
|
||||
Reference in New Issue
Block a user