From cf9c479393058b380d4665e6ee512278c3d7572d Mon Sep 17 00:00:00 2001 From: xi li <35586469+BBSQQ@users.noreply.github.com> Date: Mon, 30 Dec 2024 14:43:29 +0800 Subject: [PATCH] feat(text): optimize vis-text margin (#66) * feat(text): optimize vis-text margin * chore: add changeset --------- Co-authored-by: lvisei --- .changeset/yellow-pumas-deny.md | 5 +++++ src/Text/VisText.tsx | 10 ++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 .changeset/yellow-pumas-deny.md diff --git a/.changeset/yellow-pumas-deny.md b/.changeset/yellow-pumas-deny.md new file mode 100644 index 0000000..46331dd --- /dev/null +++ b/.changeset/yellow-pumas-deny.md @@ -0,0 +1,5 @@ +--- +'@antv/gpt-vis': patch +--- + +feat(text): optimize vis-text margin diff --git a/src/Text/VisText.tsx b/src/Text/VisText.tsx index 67fa0a0..6d3cb58 100644 --- a/src/Text/VisText.tsx +++ b/src/Text/VisText.tsx @@ -1,6 +1,7 @@ import { Tooltip, Typography } from 'antd'; import { pick, toString } from 'lodash'; import React from 'react'; +import styled from 'styled-components'; import { useComponentGlobalConfig } from '../ConfigProvider/hooks'; import { type TextConfig, STATICS_KEY } from './config'; import type { VisTextProps } from './types'; @@ -8,6 +9,11 @@ import { getThemeColor, useAntdDarkAlgorithm } from './utils'; const { Text } = Typography; +const StyledText = styled(Text)` + margin-left: 1px; + margin-right: 1px; +`; + function renderPrefixSuffix( symbol: string, staticsConfig: TextConfig[typeof STATICS_KEY], @@ -31,7 +37,7 @@ const VisText = (props: VisTextProps) => { return ( // TODO @羽熙 暂时简单处理 tooltip 直接显示 origin,后续可以根据 origin 类型分类处理 - { {renderPrefixSuffix(encoding?.prefix, staticsConfig, props)} {children} {renderPrefixSuffix(encoding?.suffix, staticsConfig, props)} - + ); };