feat(client): ts-migrate layoutSelector component (#42748)

This commit is contained in:
ABHINAV SHARMA
2021-07-12 12:35:01 +05:30
committed by GitHub
parent a33584fd5b
commit e2ca65c803
4 changed files with 18 additions and 12 deletions

View File

@ -1,6 +1,4 @@
import React from 'react';
import PropTypes from 'prop-types';
import {
CertificationLayout,
DefaultLayout
@ -8,7 +6,21 @@ import {
import FourOhFourPage from '../../src/pages/404';
import { isChallenge } from '../../src/utils/path-parsers';
export default function layoutSelector({ element, props }) {
interface Location {
pathname: string;
}
interface LayoutSelectorProps {
props: {
location: Location;
};
element: React.ReactElement;
}
export default function layoutSelector({
element,
props
}: LayoutSelectorProps): React.ReactElement {
const {
location: { pathname }
} = props;
@ -37,9 +49,3 @@ export default function layoutSelector({ element, props }) {
);
}
}
layoutSelector.propTypes = {
element: PropTypes.any,
location: PropTypes.objectOf({ pathname: PropTypes.string }),
props: PropTypes.any
};

View File

@ -2,7 +2,7 @@ import React from 'react';
import { Provider } from 'react-redux';
import ShallowRenderer from 'react-test-renderer/shallow';
import layoutSelector from './layoutSelector';
import layoutSelector from './layout-selector';
import { createStore } from '../../src/redux/createStore';
import FourOhFourPage from '../../src/pages/404';
import Learn from '../../src/pages/learn';