Skip to content

Commit 1399162

Browse files
authored
feat: Allow freeform text view resizing in modal dialogs (#2910)
1 parent 2562c13 commit 1399162

File tree

4 files changed

+17
-4
lines changed

4 files changed

+17
-4
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: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828
.left {
2929
display: flex;
3030
align-items: center;
31+
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));
3134
}
3235

3336
.right {
@@ -39,7 +42,7 @@
3942
display: flex;
4043
justify-content: center;
4144
align-items: center;
42-
flex: 1
45+
flex: 1;
4346
}
4447

4548

src/components/Modal/Modal.scss

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

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

src/components/TextInput/TextInput.scss

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@
1414
background: $inputBackgroundColor;
1515
font-size: 16px;
1616
width: 100%;
17+
min-width: 100%;
18+
min-height: 100%;
1719
padding: 6px;
1820
vertical-align: top;
19-
resize: vertical;
21+
resize: both;
2022

2123
&:focus {
2224
@include placeholder {

0 commit comments

Comments
 (0)