style: overflow layer padding

This commit is contained in:
jialin
2025-04-15 11:08:01 +08:00
parent 13ded5595a
commit ced45bec65
8 changed files with 67 additions and 88 deletions
+3 -3
View File
@@ -23,9 +23,9 @@ const TitleTip: React.FC<TitleTipProps> = (props) => {
<div style={{ maxHeight: 200, overflowY: 'auto' }} ref={scrollRef}> <div style={{ maxHeight: 200, overflowY: 'auto' }} ref={scrollRef}>
<div <div
style={{ style={{
width: 'max-content', width: 'fit-content',
maxWidth: 300, maxWidth: 'var(--width-tooltip-max)',
paddingInline: 10 paddingInline: 8
}} }}
> >
{isOverflowing || showTitle ? title || children : ''} {isOverflowing || showTitle ? title || children : ''}
+2 -9
View File
@@ -54,18 +54,11 @@ export const TooltipOverlayScroller: React.FC<
return ( return (
<Tooltip <Tooltip
overlayInnerStyle={{ overlayInnerStyle={{
width: 'max-content', paddingInline: 0
maxWidth: 300,
paddingInlineEnd: 0
}} }}
title={ title={
title && ( title && (
<OverlayScroller <OverlayScroller maxHeight={maxHeight}>{title}</OverlayScroller>
style={{ paddingInlineStart: 0 }}
maxHeight={maxHeight}
>
{title}
</OverlayScroller>
) )
} }
{...rest} {...rest}
@@ -12,42 +12,39 @@ interface NoteInfoProps {
const NoteInfo: React.FC<NoteInfoProps> = (props) => { const NoteInfo: React.FC<NoteInfoProps> = (props) => {
const { required, description, label, labelExtra } = props || {}; const { required, description, label, labelExtra } = props || {};
if (!label) return null; if (!label) return null;
const renderRequiredStar = required ? (
<span className="star" style={{ color: 'red' }}>
*
</span>
) : null;
const renderQuestionIcon = description ? (
<span
className="desc desc-icon"
style={{ marginLeft: required ? 5 : 0, color: 'gray' }}
>
<QuestionCircleOutlined />
</span>
) : null;
const labelContent = (
<>
<span>{label}</span>
{(required || description) && (
<span className="note-info">
{renderRequiredStar}
{renderQuestionIcon}
</span>
)}
</>
);
return ( return (
<span className="label-text"> <span className="label-text">
{description ? ( {description ? (
<Tooltip <Tooltip title={description}>{labelContent}</Tooltip>
title={description}
overlayInnerStyle={{
maxWidth: 'var(--width-tooltip-max)',
width: 'max-content'
}}
>
<span>{label}</span>
<span className="note-info">
{required && (
<span style={{ color: 'red' }} className="star">
*
</span>
)}
<span
style={{ marginLeft: required ? 5 : 0, color: 'gray' }}
className="desc desc-icon"
>
<QuestionCircleOutlined />
</span>
</span>
</Tooltip>
) : ( ) : (
<> labelContent
<span>{label}</span>
{required && (
<span className="note-info">
<span style={{ color: 'red' }} className="star">
*
</span>
</span>
)}
</>
)} )}
{labelExtra} {labelExtra}
</span> </span>
+17 -20
View File
@@ -1,7 +1,6 @@
import { useIntl } from '@umijs/max'; import { useIntl } from '@umijs/max';
import React from 'react'; import React from 'react';
import styled from 'styled-components'; import styled from 'styled-components';
import OverlayScroller from '../overlay-scroller';
const UL = styled.ul` const UL = styled.ul`
list-style: none; list-style: none;
@@ -31,25 +30,23 @@ const TooltipList: React.FC<TooltipListProps> = (props) => {
const intl = useIntl(); const intl = useIntl();
const { list } = props; const { list } = props;
return ( return (
<OverlayScroller style={{ padding: 0 }}> <UL>
<UL> {list.map((item, index: number) => {
{list.map((item, index: number) => { return (
return ( <li key={index}>
<li key={index}> <span className="title">
<span className="title"> {item.title?.locale
{item.title?.locale ? intl.formatMessage({ id: item.title?.text || '' })
? intl.formatMessage({ id: item.title?.text || '' }) : item.title}
: item.title} :
: </span>
</span> <span className="content">
<span className="content"> {intl.formatMessage({ id: item.tips })}
{intl.formatMessage({ id: item.tips })} </span>
</span> </li>
</li> );
); })}
})} </UL>
</UL>
</OverlayScroller>
); );
}; };
+13 -9
View File
@@ -827,17 +827,21 @@ body {
} }
} }
.ant-tooltip-content { .ant-tooltip {
.ant-tooltip-inner { max-width: var(--width-tooltip-max);
width: fit-content;
max-width: 300px;
.text-tertiary { .ant-tooltip-content {
color: var(--color-white-secondary); .ant-tooltip-inner {
} width: fit-content;
max-width: var(--width-tooltip-max);
a { .text-tertiary {
color: var(--ant-color-link-hover); color: var(--color-white-secondary);
}
a {
color: var(--ant-color-link-hover);
}
} }
} }
} }
@@ -556,11 +556,7 @@ const AddModal: React.FC<AddModalProps> = (props) => {
showOkBtn={!showExtraButton} showOkBtn={!showExtraButton}
extra={ extra={
showExtraButton && ( showExtraButton && (
<Button <Button type="primary" onClick={handleSubmitAnyway}>
type="primary"
onClick={handleSubmitAnyway}
style={{ width: '130px' }}
>
{intl.formatMessage({ {intl.formatMessage({
id: 'models.form.submit.anyway' id: 'models.form.submit.anyway'
})} })}
@@ -345,11 +345,7 @@ const AddModal: FC<AddModalProps> = (props) => {
showOkBtn={!showExtraButton} showOkBtn={!showExtraButton}
extra={ extra={
showExtraButton && ( showExtraButton && (
<Button <Button type="primary" onClick={handleSubmitAnyway}>
type="primary"
onClick={handleSubmitAnyway}
style={{ width: '130px' }}
>
{intl.formatMessage({ {intl.formatMessage({
id: 'models.form.submit.anyway' id: 'models.form.submit.anyway'
})} })}
@@ -462,11 +462,7 @@ const UpdateModal: React.FC<AddModalProps> = (props) => {
showOkBtn={!showExtraButton} showOkBtn={!showExtraButton}
extra={ extra={
showExtraButton && ( showExtraButton && (
<Button <Button type="primary" onClick={handleSubmitAnyway}>
type="primary"
onClick={handleSubmitAnyway}
style={{ width: '130px' }}
>
{intl.formatMessage({ {intl.formatMessage({
id: 'models.form.submit.anyway' id: 'models.form.submit.anyway'
})} })}