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 { .nitro-chooser-widget {
.list-item {
color: black;
overflow: hidden;
&.selected { .chooser-container {
background-color: cadetblue; min-height: 150px;
.list-item {
color: black;
overflow: hidden;
&.selected {
background-color: cadetblue;
}
} }
} }
} }

View File

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