Skip to content

Commit

Permalink
fix: fix layout of placeholder in small size
Browse files Browse the repository at this point in the history
  • Loading branch information
Aarebecca committed Aug 18, 2023
1 parent a87cbae commit fd0b73b
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const Placeholder: React.FunctionComponent<LoadingProps> = props => {
}
if (largeGraphData) {
return (
<div className="gi-placeholader" style={{ width: `${width}px` }}>
<div className="gi-placeholder" style={{ width: `${width}px` }}>
{img && <img src={img} width={width} />}
{$i18n.get({
id: 'basic.components.Placeholder.Component.TheNodeSizeOfThe',
Expand All @@ -40,9 +40,13 @@ const Placeholder: React.FunctionComponent<LoadingProps> = props => {
);
}
return (
<div className="gi-placeholader" style={{ width: `${width}px` }}>
{img && <img src={img} width={width} />}
{text}
<div className="gi-placeholder" style={{ width: `${width}px` }}>
{img && (
<div className="image-wrapper">
<img src={img} width={width} />
</div>
)}
<span>{text}</span>
</div>
);
};
Expand Down
23 changes: 19 additions & 4 deletions packages/gi-assets-basic/src/components/Placeholder/index.less
Original file line number Diff line number Diff line change
@@ -1,14 +1,29 @@
.gi-placeholader {
.gi-placeholder {
position: absolute;
top: 50%;
left: 50%;
min-width: 220px;
height: 100%;
max-width: 100%;
max-height: 100%;
text-align: center;
user-select: none;
pointer-events: none;
transform: translate3d(-50%, -50%, 0);

img {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;

.image-wrapper {
overflow: auto;
width: 100%;

img {
max-width: 100%;
max-height: 100%;
width: auto;
height: auto;
}
}
}
}

0 comments on commit fd0b73b

Please sign in to comment.