LandingPage: conversion to type script

Conversion to type script by renaming the file and correcting the type
errors.
This commit is contained in:
Thomas Lavocat 2023-08-03 16:52:05 +02:00 committed by Thomas Lavocat
parent 154429212f
commit 48bd38c496

View file

@ -27,7 +27,6 @@ import {
} from '@redhat-cloud-services/frontend-components';
import { useChrome } from '@redhat-cloud-services/frontend-components/useChrome';
import { useFlag } from '@unleash/proxy-client-react';
import PropTypes from 'prop-types';
import { Outlet, useLocation, useNavigate } from 'react-router-dom';
import './LandingPage.scss';
@ -44,7 +43,8 @@ export const LandingPage = () => {
const { quickStarts } = useChrome();
const { isBeta } = useGetEnvironment();
const activateQuickstart = (qs) => () => quickStarts.activateQuickstart(qs);
const activateQuickstart = (qs: string) => () =>
quickStarts.activateQuickstart(qs);
const { pathname } = useLocation();
const navigate = useNavigate();
@ -58,7 +58,7 @@ export const LandingPage = () => {
useEffect(() => {
setActiveTabKey(initialActiveTabKey);
}, [pathname]);
const handleTabClick = (_event, tabIndex) => {
const handleTabClick = (_event: React.MouseEvent, tabIndex: number) => {
const tabPath = tabsPath[tabIndex];
if (tabPath !== undefined) {
navigate(tabPath);
@ -312,8 +312,13 @@ export const LandingPage = () => {
);
};
const HelpPopover = ({ header, body }) => {
const ref = React.createRef();
type HelpPopoverPropTypes = {
header: string;
body: React.ReactNode;
};
const HelpPopover = ({ header, body }: HelpPopoverPropTypes) => {
const ref = React.createRef<HTMLElement>();
return (
<>
<TabAction ref={ref}>
@ -329,9 +334,4 @@ const HelpPopover = ({ header, body }) => {
);
};
HelpPopover.propTypes = {
header: PropTypes.string,
body: PropTypes.element,
};
export default LandingPage;