feat(client): ts-migrate challenge templates- challengeTitle + breadCrumbs (#42586)
This commit is contained in:
@ -2,7 +2,7 @@ import React, { Component } from 'react';
|
|||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
|
|
||||||
import ChallengeTitle from './Challenge-Title';
|
import ChallengeTitle from './challenge-title';
|
||||||
import ChallengeDescription from './Challenge-Description';
|
import ChallengeDescription from './Challenge-Description';
|
||||||
import ToolPanel from './Tool-Panel';
|
import ToolPanel from './Tool-Panel';
|
||||||
import TestSuite from './Test-Suite';
|
import TestSuite from './Test-Suite';
|
||||||
|
@ -1,18 +1,19 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
import { Link } from '../../../components/helpers/index';
|
import { Link } from '../../../components/helpers/index';
|
||||||
|
|
||||||
import './challenge-title.css';
|
import './challenge-title.css';
|
||||||
import i18next from 'i18next';
|
import i18next from 'i18next';
|
||||||
|
|
||||||
const propTypes = {
|
interface BreadCrumbProps {
|
||||||
block: PropTypes.string,
|
block: string;
|
||||||
superBlock: PropTypes.string
|
superBlock: string;
|
||||||
};
|
}
|
||||||
|
|
||||||
function BreadCrumb({ block, superBlock }) {
|
function BreadCrumb({ block, superBlock }: BreadCrumbProps): JSX.Element {
|
||||||
return (
|
return (
|
||||||
<div className='challenge-title-breadcrumbs'>
|
<div className='challenge-title-breadcrumbs'>
|
||||||
|
{/* eslint-disable-next-line @typescript-eslint/ban-ts-comment */}
|
||||||
|
{/* @ts-ignore */}
|
||||||
<Link
|
<Link
|
||||||
className='breadcrumb-left'
|
className='breadcrumb-left'
|
||||||
state={{ breadcrumbBlockClick: block }}
|
state={{ breadcrumbBlockClick: block }}
|
||||||
@ -23,6 +24,8 @@ function BreadCrumb({ block, superBlock }) {
|
|||||||
</span>
|
</span>
|
||||||
</Link>
|
</Link>
|
||||||
<div className='breadcrumb-center' />
|
<div className='breadcrumb-center' />
|
||||||
|
{/* eslint-disable-next-line @typescript-eslint/ban-ts-comment */}
|
||||||
|
{/* @ts-ignore */}
|
||||||
<Link
|
<Link
|
||||||
className='breadcrumb-right'
|
className='breadcrumb-right'
|
||||||
state={{ breadcrumbBlockClick: block }}
|
state={{ breadcrumbBlockClick: block }}
|
||||||
@ -35,6 +38,5 @@ function BreadCrumb({ block, superBlock }) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
BreadCrumb.displayName = 'BreadCrumb';
|
BreadCrumb.displayName = 'BreadCrumb';
|
||||||
BreadCrumb.propTypes = propTypes;
|
|
||||||
|
|
||||||
export default BreadCrumb;
|
export default BreadCrumb;
|
@ -1,7 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import renderer from 'react-test-renderer';
|
import renderer from 'react-test-renderer';
|
||||||
|
|
||||||
import ChallengeTitle from './Challenge-Title';
|
import ChallengeTitle from './challenge-title';
|
||||||
|
|
||||||
const baseProps = {
|
const baseProps = {
|
||||||
block: 'fake-block',
|
block: 'fake-block',
|
@ -1,19 +1,19 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
import { Link } from '../../../components/helpers/index';
|
import { Link } from '../../../components/helpers/index';
|
||||||
import i18next from 'i18next';
|
import i18next from 'i18next';
|
||||||
|
|
||||||
import './challenge-title.css';
|
import './challenge-title.css';
|
||||||
import GreenPass from '../../../assets/icons/green-pass';
|
|
||||||
import BreadCrumb from './BreadCrumb';
|
|
||||||
|
|
||||||
const propTypes = {
|
import GreenPass from '../../../assets/icons/green-pass';
|
||||||
block: PropTypes.string,
|
import BreadCrumb from './bread-crumb';
|
||||||
children: PropTypes.string,
|
|
||||||
isCompleted: PropTypes.bool,
|
interface ChallengeTitleProps {
|
||||||
superBlock: PropTypes.string,
|
block: string;
|
||||||
translationPending: PropTypes.bool.isRequired
|
children: string;
|
||||||
};
|
isCompleted: boolean;
|
||||||
|
superBlock: string;
|
||||||
|
translationPending: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
function ChallengeTitle({
|
function ChallengeTitle({
|
||||||
block,
|
block,
|
||||||
@ -21,16 +21,21 @@ function ChallengeTitle({
|
|||||||
isCompleted,
|
isCompleted,
|
||||||
superBlock,
|
superBlock,
|
||||||
translationPending
|
translationPending
|
||||||
}) {
|
}: ChallengeTitleProps): JSX.Element {
|
||||||
return (
|
return (
|
||||||
<div className='challenge-title-wrap'>
|
<div className='challenge-title-wrap'>
|
||||||
{translationPending && (
|
{translationPending && (
|
||||||
<Link
|
<>
|
||||||
className='title-translation-cta'
|
{/* eslint-disable-next-line @typescript-eslint/ban-ts-comment */}
|
||||||
to={i18next.t('links:help-translate-link-url')}
|
{/* @ts-ignore */}
|
||||||
>
|
<Link
|
||||||
{i18next.t('misc.translation-pending')}
|
className='title-translation-cta'
|
||||||
</Link>
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||||
|
to={i18next.t('links:help-translate-link-url')}
|
||||||
|
>
|
||||||
|
{i18next.t('misc.translation-pending')}
|
||||||
|
</Link>
|
||||||
|
</>
|
||||||
)}
|
)}
|
||||||
<BreadCrumb block={block} superBlock={superBlock} />
|
<BreadCrumb block={block} superBlock={superBlock} />
|
||||||
<div className='challenge-title'>
|
<div className='challenge-title'>
|
||||||
@ -48,6 +53,5 @@ function ChallengeTitle({
|
|||||||
}
|
}
|
||||||
|
|
||||||
ChallengeTitle.displayName = 'ChallengeTitle';
|
ChallengeTitle.displayName = 'ChallengeTitle';
|
||||||
ChallengeTitle.propTypes = propTypes;
|
|
||||||
|
|
||||||
export default ChallengeTitle;
|
export default ChallengeTitle;
|
@ -23,7 +23,7 @@ import {
|
|||||||
} from '../../redux';
|
} from '../../redux';
|
||||||
import { getGuideUrl } from '../../utils';
|
import { getGuideUrl } from '../../utils';
|
||||||
import LearnLayout from '../../../../components/layouts/Learn';
|
import LearnLayout from '../../../../components/layouts/Learn';
|
||||||
import ChallengeTitle from '../../components/Challenge-Title';
|
import ChallengeTitle from '../../components/challenge-title';
|
||||||
import ChallengeDescription from '../../components/Challenge-Description';
|
import ChallengeDescription from '../../components/Challenge-Description';
|
||||||
import TestSuite from '../../components/Test-Suite';
|
import TestSuite from '../../components/Test-Suite';
|
||||||
import Output from '../../components/Output';
|
import Output from '../../components/Output';
|
||||||
|
@ -25,7 +25,7 @@ import {
|
|||||||
} from '../../redux';
|
} from '../../redux';
|
||||||
import { getGuideUrl } from '../../utils';
|
import { getGuideUrl } from '../../utils';
|
||||||
import LearnLayout from '../../../../components/layouts/Learn';
|
import LearnLayout from '../../../../components/layouts/Learn';
|
||||||
import ChallengeTitle from '../../components/Challenge-Title';
|
import ChallengeTitle from '../../components/challenge-title';
|
||||||
import ChallengeDescription from '../../components/Challenge-Description';
|
import ChallengeDescription from '../../components/Challenge-Description';
|
||||||
import Spacer from '../../../../components/helpers/spacer';
|
import Spacer from '../../../../components/helpers/spacer';
|
||||||
import SolutionForm from '../SolutionForm';
|
import SolutionForm from '../SolutionForm';
|
||||||
|
@ -18,7 +18,7 @@ import {
|
|||||||
ChallengeMetaType
|
ChallengeMetaType
|
||||||
} from '../../../redux/prop-types';
|
} from '../../../redux/prop-types';
|
||||||
import LearnLayout from '../../../components/layouts/Learn';
|
import LearnLayout from '../../../components/layouts/Learn';
|
||||||
import ChallengeTitle from '../components/Challenge-Title';
|
import ChallengeTitle from '../components/challenge-title';
|
||||||
import ChallengeDescription from '../components/Challenge-Description';
|
import ChallengeDescription from '../components/Challenge-Description';
|
||||||
import Spacer from '../../../components/helpers/spacer';
|
import Spacer from '../../../components/helpers/spacer';
|
||||||
import CompletionModal from '../components/CompletionModal';
|
import CompletionModal from '../components/CompletionModal';
|
||||||
|
Reference in New Issue
Block a user