Skip to content

Commit 8acc61d

Browse files
committed
fix: modal label width grows when resizing text field
1 parent 87734a4 commit 8acc61d

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

src/components/Field/Field.react.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,13 @@ const Field = ({ label, input, labelWidth = 50, labelPadding, height, className
2323
}
2424
return (
2525
<div className={classes.join(' ')}>
26-
<div className={styles.left} style={{ width: labelWidth + '% ', height: height }}>
26+
<div
27+
className={styles.left}
28+
style={{
29+
height: height,
30+
'--modal-label-ratio': labelWidth / 100,
31+
}}
32+
>
2733
{label}
2834
</div>
2935
<div className={styles.right} style={{ height: height }}>

src/components/Field/Field.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
display: flex;
3030
align-items: center;
3131
flex-shrink: 0;
32+
width: calc(var(--modal-min-width, 540px) * var(--modal-label-ratio, 0.5));
33+
max-width: calc(var(--modal-min-width, 540px) * var(--modal-label-ratio, 0.5));
3234
}
3335

3436
.right {

src/components/Modal/Modal.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@
99

1010
.modal {
1111
@include modalAnimation();
12+
--modal-min-width: 540px;
1213
position: absolute;
1314
top: 50%;
1415
left: 50%;
1516
width: auto;
16-
min-width: 540px;
17+
min-width: var(--modal-min-width);
1718
background: white;
1819
border-radius: 5px;
1920
overflow: hidden;

0 commit comments

Comments
 (0)