mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 07:45:18 +00:00
feat(plugin-workflow): add space control to RadioWithTooltip (#3252)
This commit is contained in:
parent
e4c97651bf
commit
0330e33704
@ -1,6 +1,6 @@
|
||||
import { QuestionCircleOutlined } from '@ant-design/icons';
|
||||
import { css, useCompile } from '@nocobase/client';
|
||||
import { Radio, Tooltip } from 'antd';
|
||||
import { Radio, Space, Tooltip } from 'antd';
|
||||
import React from 'react';
|
||||
|
||||
export interface RadioWithTooltipOption {
|
||||
@ -10,29 +10,31 @@ export interface RadioWithTooltipOption {
|
||||
}
|
||||
|
||||
export function RadioWithTooltip(props) {
|
||||
const { options = [], ...other } = props;
|
||||
const { options = [], direction, ...other } = props;
|
||||
const compile = useCompile();
|
||||
|
||||
return (
|
||||
<Radio.Group {...other}>
|
||||
{options.map((option) => (
|
||||
<Radio key={option.value} value={option.value}>
|
||||
<span
|
||||
className={css`
|
||||
& + .anticon {
|
||||
margin-left: 0.25em;
|
||||
}
|
||||
`}
|
||||
>
|
||||
{compile(option.label)}
|
||||
</span>
|
||||
{option.tooltip && (
|
||||
<Tooltip title={compile(option.tooltip)}>
|
||||
<QuestionCircleOutlined style={{ color: '#666' }} />
|
||||
</Tooltip>
|
||||
)}
|
||||
</Radio>
|
||||
))}
|
||||
<Space direction={direction}>
|
||||
{options.map((option) => (
|
||||
<Radio key={option.value} value={option.value}>
|
||||
<span
|
||||
className={css`
|
||||
& + .anticon {
|
||||
margin-left: 0.25em;
|
||||
}
|
||||
`}
|
||||
>
|
||||
{compile(option.label)}
|
||||
</span>
|
||||
{option.tooltip && (
|
||||
<Tooltip title={compile(option.tooltip)}>
|
||||
<QuestionCircleOutlined style={{ color: '#666' }} />
|
||||
</Tooltip>
|
||||
)}
|
||||
</Radio>
|
||||
))}
|
||||
</Space>
|
||||
</Radio.Group>
|
||||
);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user