fix chooser resize

This commit is contained in:
dank074 2021-11-02 21:38:58 -05:00
parent 5020f1f063
commit 4a8f738bb0
2 changed files with 24 additions and 12 deletions

View File

@ -1,11 +1,16 @@
.nitro-chooser-widget {
.list-item {
color: black;
overflow: hidden;
.chooser-container {
min-height: 150px;
&.selected {
background-color: cadetblue;
.list-item {
color: black;
overflow: hidden;
&.selected {
background-color: cadetblue;
}
}
}
}

View File

@ -1,5 +1,5 @@
import { FC, useCallback, useMemo, useState } from 'react';
import { List, ListRowProps, ListRowRenderer } from 'react-virtualized';
import { AutoSizer, List, ListRowProps, ListRowRenderer } from 'react-virtualized';
import { RoomObjectItem, RoomWidgetRoomObjectMessage } from '../../../../api';
import { LocalizeText } from '../../../../api/utils';
import { NitroCardContentView, NitroCardHeaderView, NitroCardView } from '../../../../layout';
@ -53,12 +53,19 @@ export const ChooserWidgetView: FC<ChooserWidgetViewProps> = props =>
<input type="text" className="form-control form-control-sm" placeholder={ LocalizeText('generic.search') } value={searchValue} onChange={event => setSearchValue(event.target.value)} />
</div>
</div>
<List
width={ 150 }
height={ 150 }
rowCount={ filteredItems.length }
rowHeight={ 20 }
rowRenderer={ rowRenderer } />
<div className="row w-100 h-100 chooser-container">
<AutoSizer defaultWidth={150} defaultHeight={150}>
{({ height, width }) =>
{
return (<List
width={ width }
height={ height }
rowCount={ filteredItems.length }
rowHeight={ 20 }
rowRenderer={ rowRenderer } />)
}}
</AutoSizer>
</div>
</NitroCardContentView>
</NitroCardView>
);