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;
return ( const renderRequiredStar = required ? (
<span className="label-text"> <span className="star" style={{ color: 'red' }}>
{description ? (
<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>
)} ) : null;
const renderQuestionIcon = description ? (
<span <span
style={{ marginLeft: required ? 5 : 0, color: 'gray' }}
className="desc desc-icon" className="desc desc-icon"
style={{ marginLeft: required ? 5 : 0, color: 'gray' }}
> >
<QuestionCircleOutlined /> <QuestionCircleOutlined />
</span> </span>
</span> ) : null;
</Tooltip>
) : ( const labelContent = (
<> <>
<span>{label}</span> <span>{label}</span>
{required && ( {(required || description) && (
<span className="note-info"> <span className="note-info">
<span style={{ color: 'red' }} className="star"> {renderRequiredStar}
* {renderQuestionIcon}
</span>
</span> </span>
)} )}
</> </>
);
return (
<span className="label-text">
{description ? (
<Tooltip title={description}>{labelContent}</Tooltip>
) : (
labelContent
)} )}
{labelExtra} {labelExtra}
</span> </span>
-3
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,7 +30,6 @@ 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 (
@@ -49,7 +47,6 @@ const TooltipList: React.FC<TooltipListProps> = (props) => {
); );
})} })}
</UL> </UL>
</OverlayScroller>
); );
}; };
+6 -2
View File
@@ -827,10 +827,13 @@ body {
} }
} }
.ant-tooltip-content { .ant-tooltip {
max-width: var(--width-tooltip-max);
.ant-tooltip-content {
.ant-tooltip-inner { .ant-tooltip-inner {
width: fit-content; width: fit-content;
max-width: 300px; max-width: var(--width-tooltip-max);
.text-tertiary { .text-tertiary {
color: var(--color-white-secondary); color: var(--color-white-secondary);
@@ -840,6 +843,7 @@ body {
color: var(--ant-color-link-hover); color: var(--ant-color-link-hover);
} }
} }
}
} }
.light-downloading-tooltip { .light-downloading-tooltip {
@@ -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'
})} })}