File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -48,6 +48,8 @@ interface AddTabDialogProps {
4848
4949/** Height of the scrollable lists in pixels. */
5050const LIST_HEIGHT = 200 ;
51+ const ITEM_HEIGHT = 45 ;
52+ const EMPTY_HEIGHT = 60 ;
5153
5254/**
5355 * Dialog component for adding new tabs to the workspace.
@@ -131,6 +133,10 @@ export default function AddTabDialog(props: AddTabDialogProps) {
131133 }
132134 } ;
133135
136+ const getListHeight = ( ) : number => {
137+ return Math . max ( EMPTY_HEIGHT , Math . min ( LIST_HEIGHT , availableItems . length * ITEM_HEIGHT ) ) ;
138+ }
139+
134140 return (
135141 < Antd . Modal
136142 title = { t ( 'addTabDialog.title' ) }
@@ -159,7 +165,7 @@ export default function AddTabDialog(props: AddTabDialogProps) {
159165 < Antd . List
160166 size = "small"
161167 bordered
162- style = { { height : LIST_HEIGHT , overflow : 'auto' , marginBottom : 16 } }
168+ style = { { height : getListHeight ( ) , overflow : 'auto' , marginBottom : 16 } }
163169 dataSource = { availableItems }
164170 renderItem = { ( item ) => (
165171 < Antd . List . Item
You can’t perform that action at this time.
0 commit comments