blob: e4174a0e7cb0da90fc9fd028b02deffbc2490e31 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
import * as React from 'react';
import { RelayLocation } from '../../shared/daemon-rpc-types';
import { IRelayLocationRedux } from '../redux/settings/reducers';
import LocationList, {
LocationSelection,
LocationSelectionType,
RelayLocations,
} from './LocationList';
interface IExitLocationsProps {
source: IRelayLocationRedux[];
defaultExpandedLocations?: RelayLocation[];
selectedValue?: RelayLocation;
selectedElementRef?: React.Ref<React.ReactInstance>;
onSelect?: (value: LocationSelection<never>) => void;
onWillExpand?: (locationRect: DOMRect, expandedContentHeight: number) => void;
onTransitionEnd?: () => void;
}
const ExitLocations = React.forwardRef(function ExitLocationsT(
props: IExitLocationsProps,
ref: React.Ref<LocationList<never>>,
) {
const selectedValue: LocationSelection<never> | undefined = props.selectedValue
? { type: LocationSelectionType.relay, value: props.selectedValue }
: undefined;
return (
<LocationList
ref={ref}
defaultExpandedLocations={props.defaultExpandedLocations}
selectedValue={selectedValue}
selectedElementRef={props.selectedElementRef}
onSelect={props.onSelect}>
<RelayLocations
source={props.source}
onWillExpand={props.onWillExpand}
onTransitionEnd={props.onTransitionEnd}
/>
</LocationList>
);
});
export default ExitLocations;
|