Fixed reactstrap 9 deprecated warnings

This commit is contained in:
Alejandro Celaya 2022-03-11 16:37:41 +01:00
parent a8f996bec7
commit c4148f0494
11 changed files with 12 additions and 14 deletions

View file

@ -29,7 +29,7 @@ const Home = ({ servers }: HomeProps) => {
return ( return (
<div className="home"> <div className="home">
<Card className="home__main-card"> <Card className="home__main-card">
<Row noGutters> <Row className="g-0">
<div className="col-md-5 d-none d-md-block"> <div className="col-md-5 d-none d-md-block">
<div className="home__logo-wrapper"> <div className="home__logo-wrapper">
<div className="home__logo"> <div className="home__logo">

View file

@ -42,7 +42,7 @@ const ServersDropdown = ({ servers, selectedServer }: ServersDropdownProps) => {
<DropdownToggle nav caret> <DropdownToggle nav caret>
<FontAwesomeIcon icon={serverIcon} /> <span className="ms-1">Servers</span> <FontAwesomeIcon icon={serverIcon} /> <span className="ms-1">Servers</span>
</DropdownToggle> </DropdownToggle>
<DropdownMenu right style={{ right: 0 }}>{renderServers()}</DropdownMenu> <DropdownMenu end style={{ right: 0 }}>{renderServers()}</DropdownMenu>
</UncontrolledDropdown> </UncontrolledDropdown>
); );
}; };

View file

@ -22,7 +22,7 @@ export const DropdownBtn: FC<DropdownBtnProps> = (
return ( return (
<Dropdown isOpen={isOpen} toggle={toggle} disabled={disabled} className={dropdownClassName}> <Dropdown isOpen={isOpen} toggle={toggle} disabled={disabled} className={dropdownClassName}>
<DropdownToggle caret className={toggleClasses} color="primary">{text}</DropdownToggle> <DropdownToggle caret className={toggleClasses} color="primary">{text}</DropdownToggle>
<DropdownMenu className="w-100" right={right} style={style}>{children}</DropdownMenu> <DropdownMenu className="w-100" end={right} style={style}>{children}</DropdownMenu>
</Dropdown> </Dropdown>
); );
}; };

View file

@ -15,6 +15,6 @@ export const DropdownBtnMenu: FC<DropdownBtnMenuProps> = ({ isOpen, toggle, chil
<DropdownToggle size="sm" caret outline className="dropdown-btn-menu__dropdown-toggle"> <DropdownToggle size="sm" caret outline className="dropdown-btn-menu__dropdown-toggle">
&nbsp;<FontAwesomeIcon icon={menuIcon} />&nbsp; &nbsp;<FontAwesomeIcon icon={menuIcon} />&nbsp;
</DropdownToggle> </DropdownToggle>
<DropdownMenu right={right}>{children}</DropdownMenu> <DropdownMenu end={right}>{children}</DropdownMenu>
</ButtonDropdown> </ButtonDropdown>
); );

View file

@ -37,7 +37,7 @@ const Message: FC<MessageProps> = ({ className, children, loading = false, type
}); });
return ( return (
<Row noGutters className={className}> <Row className={classNames('g-0', className)}>
<div className={classes}> <div className={classes}>
<Card className={getClassForType(type)} body> <Card className={getClassForType(type)} body>
<h3 className={classNames('text-center mb-0', getTextClassForType(type))}> <h3 className={classNames('text-center mb-0', getTextClassForType(type))}>

View file

@ -35,7 +35,7 @@ export function OrderingDropdown<T extends string = string>(
{isButton && order.field && `Order by: "${items[order.field]}" - "${order.dir ?? 'DESC'}"`} {isButton && order.field && `Order by: "${items[order.field]}" - "${order.dir ?? 'DESC'}"`}
</DropdownToggle> </DropdownToggle>
<DropdownMenu <DropdownMenu
right={right} end={right}
className={classNames('w-100', { 'ordering-dropdown__menu--link': !isButton })} className={classNames('w-100', { 'ordering-dropdown__menu--link': !isButton })}
> >
{toPairs(items).map(([ fieldKey, fieldValue ]) => ( {toPairs(items).map(([ fieldKey, fieldValue ]) => (

View file

@ -9,10 +9,8 @@ interface PaginationDropdownProps {
const PaginationDropdown = ({ toggleClassName, ranges, value, setValue }: PaginationDropdownProps) => ( const PaginationDropdown = ({ toggleClassName, ranges, value, setValue }: PaginationDropdownProps) => (
<UncontrolledDropdown> <UncontrolledDropdown>
<DropdownToggle caret color="link" className={toggleClassName}> <DropdownToggle caret color="link" className={toggleClassName}>Paginate</DropdownToggle>
Paginate <DropdownMenu end>
</DropdownToggle>
<DropdownMenu right>
{ranges.map((itemsPerPage) => ( {ranges.map((itemsPerPage) => (
<DropdownItem key={itemsPerPage} active={itemsPerPage === value} onClick={() => setValue(itemsPerPage)}> <DropdownItem key={itemsPerPage} active={itemsPerPage === value} onClick={() => setValue(itemsPerPage)}>
<b>{itemsPerPage}</b> items per page <b>{itemsPerPage}</b> items per page

View file

@ -237,7 +237,7 @@ const LineChartCard = (
<DropdownToggle caret color="link" className="btn-sm p-0"> <DropdownToggle caret color="link" className="btn-sm p-0">
Group by Group by
</DropdownToggle> </DropdownToggle>
<DropdownMenu right> <DropdownMenu end>
{Object.entries(STEPS_MAP).map(([ value, menuText ]) => ( {Object.entries(STEPS_MAP).map(([ value, menuText ]) => (
<DropdownItem key={value} active={step === value} onClick={() => setStep(value as Step)}> <DropdownItem key={value} active={step === value} onClick={() => setStep(value as Step)}>
{menuText} {menuText}

View file

@ -42,7 +42,7 @@ const OpenMapModalBtn = ({ modalTitle, activeCities, locations = [] }: OpenMapMo
</button> </button>
<UncontrolledTooltip placement="left" target={(() => buttonRef.current) as any}>Show in map</UncontrolledTooltip> <UncontrolledTooltip placement="left" target={(() => buttonRef.current) as any}>Show in map</UncontrolledTooltip>
<Dropdown isOpen={dropdownIsOpened} toggle={toggleDropdown} inNavbar> <Dropdown isOpen={dropdownIsOpened} toggle={toggleDropdown} inNavbar>
<DropdownMenu right> <DropdownMenu end>
<DropdownItem onClick={openMapWithLocations(false)}>Show all locations</DropdownItem> <DropdownItem onClick={openMapWithLocations(false)}>Show all locations</DropdownItem>
<DropdownItem onClick={openMapWithLocations(true)}>Show locations in current page</DropdownItem> <DropdownItem onClick={openMapWithLocations(true)}>Show locations in current page</DropdownItem>
</DropdownMenu> </DropdownMenu>

View file

@ -43,6 +43,6 @@ describe('<DropdownBtnMenu />', () => {
])('renders menu to right when expected', (right, expectedRight) => { ])('renders menu to right when expected', (right, expectedRight) => {
const wrapper = createWrapper({ right }); const wrapper = createWrapper({ right });
expect(wrapper.find(DropdownMenu).prop('right')).toEqual(expectedRight); expect(wrapper.find(DropdownMenu).prop('end')).toEqual(expectedRight);
}); });
}); });

View file

@ -59,6 +59,6 @@ describe('<Message />', () => {
it.each([{ className: 'foo' }, { className: 'bar' }, {}])('renders provided classes', ({ className }) => { it.each([{ className: 'foo' }, { className: 'bar' }, {}])('renders provided classes', ({ className }) => {
const wrapper = createWrapper({ className }); const wrapper = createWrapper({ className });
expect(wrapper.prop('className')).toEqual(className); expect(wrapper.prop('className')).toEqual(`g-0${className ? ` ${className}` : ''}`);
}); });
}); });