sealday
3e58c54aa8
Co-authored-by: hello@lv <2256334253@qq.com> Co-authored-by: wjh <wwwjh0710@163.com> Co-authored-by: sealday <sealday@gmail.com> Reviewed-on: daoyoucloud/tachybase#719
30 lines
756 B
TypeScript
30 lines
756 B
TypeScript
import { css, i18n } from '@tachybase/client';
|
|
import { Evaluator, evaluators } from '@tachybase/evaluators/client';
|
|
import { Registry } from '@tachybase/utils/client';
|
|
import React from 'react';
|
|
import { NAMESPACE } from './locale';
|
|
|
|
export function renderExpressionDescription(key: string) {
|
|
const engine = (evaluators as Registry<Evaluator>).get(key);
|
|
|
|
return engine?.link ? (
|
|
<>
|
|
<span
|
|
className={css`
|
|
&:after {
|
|
content: ':';
|
|
}
|
|
& + a {
|
|
margin-left: 0.25em;
|
|
}
|
|
`}
|
|
>
|
|
{i18n.t('Syntax references', { ns: NAMESPACE })}
|
|
</span>
|
|
<a href={engine.link} target="_blank" rel="noreferrer">
|
|
{engine.label}
|
|
</a>
|
|
</>
|
|
) : null;
|
|
}
|