diff --git a/src/domains/DomainSelector.tsx b/src/domains/DomainSelector.tsx index f034731b..c843f409 100644 --- a/src/domains/DomainSelector.tsx +++ b/src/domains/DomainSelector.tsx @@ -4,7 +4,7 @@ import { InputProps } from 'reactstrap/lib/Input'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { faUndo } from '@fortawesome/free-solid-svg-icons'; import { isEmpty, pipe } from 'ramda'; -import { Dropdown } from '../utils/Dropdown'; +import { DropdownBtn } from '../utils/DropdownBtn'; import { useToggle } from '../utils/helpers/hooks'; import { DomainsList } from './reducers/domainsList'; import './DomainSelector.scss'; @@ -52,7 +52,7 @@ export const DomainSelector = ({ listDomains, value, domainsList, onChange }: Do ) : ( - @@ -70,6 +70,6 @@ export const DomainSelector = ({ listDomains, value, domainsList, onChange }: Do New domain - + ); }; diff --git a/src/utils/Dropdown.tsx b/src/utils/DropdownBtn.tsx similarity index 59% rename from src/utils/Dropdown.tsx rename to src/utils/DropdownBtn.tsx index c7e2f9fc..512b5f18 100644 --- a/src/utils/Dropdown.tsx +++ b/src/utils/DropdownBtn.tsx @@ -1,22 +1,22 @@ import { FC } from 'react'; -import { Dropdown as BsDropdown, DropdownMenu, DropdownToggle } from 'reactstrap'; +import { Dropdown, DropdownMenu, DropdownToggle } from 'reactstrap'; import { useToggle } from './helpers/hooks'; import './Dropdown.scss'; -export interface DropdownProps { +export interface DropdownBtnProps { text: string; disabled?: boolean; className?: string; } -export const Dropdown: FC = ({ text, disabled = false, className = '', children }) => { +export const DropdownBtn: FC = ({ text, disabled = false, className = '', children }) => { const [ isOpen, toggle ] = useToggle(); const toggleClasses = `dropdown__btn btn-block ${className}`; return ( - + {text} {children} - + ); }; diff --git a/src/utils/dates/DateRangeSelector.tsx b/src/utils/dates/DateRangeSelector.tsx index 9d8e0d93..1b680f90 100644 --- a/src/utils/dates/DateRangeSelector.tsx +++ b/src/utils/dates/DateRangeSelector.tsx @@ -1,6 +1,6 @@ import { useState } from 'react'; import { DropdownItem } from 'reactstrap'; -import { Dropdown } from '../Dropdown'; +import { DropdownBtn } from '../DropdownBtn'; import { DateInterval, DateRange, @@ -39,7 +39,7 @@ export const DateRangeSelector = ( }; return ( - + updateDateRange({ ...activeDateRange, endDate })} /> - + ); }; diff --git a/test/domains/DomainSelector.test.tsx b/test/domains/DomainSelector.test.tsx index 0e080a01..ec9ae9d6 100644 --- a/test/domains/DomainSelector.test.tsx +++ b/test/domains/DomainSelector.test.tsx @@ -4,7 +4,7 @@ import { DropdownItem, InputGroup } from 'reactstrap'; import { DomainSelector } from '../../src/domains/DomainSelector'; import { DomainsList } from '../../src/domains/reducers/domainsList'; import { ShlinkDomain } from '../../src/api/types'; -import { Dropdown } from '../../src/utils/Dropdown'; +import { DropdownBtn } from '../../src/utils/DropdownBtn'; describe('', () => { let wrapper: ShallowWrapper; @@ -24,7 +24,7 @@ describe('', () => { it('shows dropdown by default', () => { const input = wrapper.find(InputGroup); - const dropdown = wrapper.find(Dropdown); + const dropdown = wrapper.find(DropdownBtn); expect(input).toHaveLength(0); expect(dropdown).toHaveLength(1); @@ -34,10 +34,10 @@ describe('', () => { it('allows to toggle between dropdown and input', () => { wrapper.find(DropdownItem).last().simulate('click'); expect(wrapper.find(InputGroup)).toHaveLength(1); - expect(wrapper.find(Dropdown)).toHaveLength(0); + expect(wrapper.find(DropdownBtn)).toHaveLength(0); wrapper.find('.domains-dropdown__back-btn').simulate('click'); expect(wrapper.find(InputGroup)).toHaveLength(0); - expect(wrapper.find(Dropdown)).toHaveLength(1); + expect(wrapper.find(DropdownBtn)).toHaveLength(1); }); }); diff --git a/test/utils/Dropdown.test.tsx b/test/utils/DropdownBtn.test.tsx similarity index 83% rename from test/utils/Dropdown.test.tsx rename to test/utils/DropdownBtn.test.tsx index b0ed8a95..0ce97144 100644 --- a/test/utils/Dropdown.test.tsx +++ b/test/utils/DropdownBtn.test.tsx @@ -1,12 +1,12 @@ import { shallow, ShallowWrapper } from 'enzyme'; import { DropdownMenu, DropdownToggle } from 'reactstrap'; import { PropsWithChildren } from 'react'; -import { Dropdown, DropdownProps } from '../../src/utils/Dropdown'; +import { DropdownBtn, DropdownBtnProps } from '../../src/utils/DropdownBtn'; -describe('', () => { +describe('', () => { let wrapper: ShallowWrapper; - const createWrapper = (props: PropsWithChildren) => { - wrapper = shallow(); + const createWrapper = (props: PropsWithChildren) => { + wrapper = shallow(); return wrapper; };