2022-03-13 08:48:15 +01:00
|
|
|
import React, { useRef, forwardRef } from 'react';
|
|
|
|
import Dropdown from 'components/Dropdown';
|
2022-03-15 21:48:38 +01:00
|
|
|
import { IconAdjustmentsHorizontal, IconCaretDown } from '@tabler/icons';
|
2022-03-13 08:48:15 +01:00
|
|
|
import StyledWrapper from './StyledWrapper';
|
|
|
|
|
|
|
|
const EnvironmentSelector = () => {
|
|
|
|
const dropdownTippyRef = useRef();
|
|
|
|
|
|
|
|
const Icon = forwardRef((props, ref) => {
|
|
|
|
return (
|
|
|
|
<div ref={ref} className="current-enviroment flex items-center justify-center px-3 py-1 select-none">
|
2022-03-15 21:48:38 +01:00
|
|
|
No Environment
|
|
|
|
<IconCaretDown className="caret" size={14} strokeWidth={2}/>
|
2022-03-13 08:48:15 +01:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
|
|
|
const onDropdownCreate = (ref) => dropdownTippyRef.current = ref;
|
|
|
|
|
|
|
|
return (
|
|
|
|
<StyledWrapper>
|
|
|
|
<div className="flex items-center cursor-pointer environment-selector pr-3">
|
2022-03-13 22:13:36 +01:00
|
|
|
<Dropdown onCreate={onDropdownCreate} icon={<Icon />} placement='bottom-end'>
|
2022-03-13 08:48:15 +01:00
|
|
|
<div className="dropdown-item" onClick={() => {
|
|
|
|
dropdownTippyRef.current.hide();
|
|
|
|
}}>
|
|
|
|
<span>QA1</span>
|
|
|
|
</div>
|
|
|
|
<div className="dropdown-item" onClick={() => {
|
|
|
|
dropdownTippyRef.current.hide();
|
|
|
|
}}>
|
|
|
|
<span>STG</span>
|
|
|
|
</div>
|
|
|
|
<div className="dropdown-item" onClick={() => {
|
|
|
|
dropdownTippyRef.current.hide();
|
|
|
|
}}>
|
|
|
|
<span>No Environment</span>
|
|
|
|
</div>
|
|
|
|
<div className="dropdown-item" style={{borderTop: 'solid 1px #e7e7e7'}} onClick={() => {
|
|
|
|
dropdownTippyRef.current.hide();
|
|
|
|
}}>
|
|
|
|
<div className="pr-2 text-gray-600">
|
|
|
|
<IconAdjustmentsHorizontal size={18} strokeWidth={1.5}/>
|
|
|
|
</div>
|
|
|
|
<span>Settings</span>
|
|
|
|
</div>
|
|
|
|
</Dropdown>
|
|
|
|
</div>
|
|
|
|
</StyledWrapper>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default EnvironmentSelector;
|