refactor: only use dasherized superBlock (#41067)
This commit is contained in:
committed by
GitHub
parent
73f8377d68
commit
97fcaa693f
@@ -6,7 +6,6 @@ import { generateIconComponent } from '../../assets/icons';
|
||||
|
||||
import { Link, Spacer } from '../helpers';
|
||||
import LinkButton from '../../assets/icons/LinkButton';
|
||||
import { dasherize } from '../../../../utils/slugs';
|
||||
import './map.css';
|
||||
import { isAuditedCert } from '../../../../utils/is-audited';
|
||||
import { curriculumLocale } from '../../../../config/env.json';
|
||||
@@ -16,11 +15,9 @@ const propTypes = {
|
||||
forLanding: PropTypes.bool
|
||||
};
|
||||
|
||||
const codingPrepRE = new RegExp('Interview Prep');
|
||||
|
||||
function createSuperBlockTitle(str) {
|
||||
const superBlockTitle = i18next.t(`intro:${dasherize(str)}.title`);
|
||||
return codingPrepRE.test(str)
|
||||
function createSuperBlockTitle(superBlock) {
|
||||
const superBlockTitle = i18next.t(`intro:${superBlock}.title`);
|
||||
return superBlock === 'coding-interview-prep'
|
||||
? i18next.t('learn.cert-map-estimates.coding-prep', {
|
||||
title: superBlockTitle
|
||||
})
|
||||
@@ -34,18 +31,18 @@ const linkSpacingStyle = {
|
||||
};
|
||||
|
||||
function renderLandingMap(nodes) {
|
||||
nodes = nodes.filter(node => node.superBlock !== 'Coding Interview Prep');
|
||||
nodes = nodes.filter(node => node.superBlock !== 'coding-interview-prep');
|
||||
return (
|
||||
<ul data-test-label='certifications'>
|
||||
{nodes.map((node, i) => (
|
||||
<li key={i}>
|
||||
<Link
|
||||
className='btn link-btn btn-lg'
|
||||
to={`/learn/${dasherize(node.superBlock)}/`}
|
||||
to={`/learn/${node.superBlock}/`}
|
||||
>
|
||||
<div style={linkSpacingStyle}>
|
||||
{generateIconComponent(node.superBlock, 'map-icon')}
|
||||
{i18next.t(`intro:${dasherize(node.superBlock)}.title`)}
|
||||
{i18next.t(`intro:${node.superBlock}.title`)}
|
||||
</div>
|
||||
<LinkButton />
|
||||
</Link>
|
||||
@@ -63,7 +60,7 @@ function renderLearnMap(nodes, currentSuperBlock = '') {
|
||||
<li key={i}>
|
||||
<Link
|
||||
className='btn link-btn btn-lg'
|
||||
to={`/learn/${dasherize(node.superBlock)}/`}
|
||||
to={`/learn/${node.superBlock}/`}
|
||||
>
|
||||
<div style={linkSpacingStyle}>
|
||||
{generateIconComponent(node.superBlock, 'map-icon')}
|
||||
@@ -76,14 +73,12 @@ function renderLearnMap(nodes, currentSuperBlock = '') {
|
||||
) : (
|
||||
<ul data-test-label='learn-curriculum-map'>
|
||||
{nodes
|
||||
.filter(node =>
|
||||
isAuditedCert(curriculumLocale, dasherize(node.superBlock))
|
||||
)
|
||||
.filter(node => isAuditedCert(curriculumLocale, node.superBlock))
|
||||
.map((node, i) => (
|
||||
<li key={i}>
|
||||
<Link
|
||||
className='btn link-btn btn-lg'
|
||||
to={`/learn/${dasherize(node.superBlock)}/`}
|
||||
to={`/learn/${node.superBlock}/`}
|
||||
>
|
||||
<div style={linkSpacingStyle}>
|
||||
{generateIconComponent(node.superBlock, 'map-icon')}
|
||||
@@ -105,14 +100,12 @@ function renderLearnMap(nodes, currentSuperBlock = '') {
|
||||
<Spacer />
|
||||
</div>
|
||||
{nodes
|
||||
.filter(
|
||||
node => !isAuditedCert(curriculumLocale, dasherize(node.superBlock))
|
||||
)
|
||||
.filter(node => !isAuditedCert(curriculumLocale, node.superBlock))
|
||||
.map((node, i) => (
|
||||
<li key={i}>
|
||||
<Link
|
||||
className='btn link-btn btn-lg'
|
||||
to={`/learn/${dasherize(node.superBlock)}/`}
|
||||
to={`/learn/${node.superBlock}/`}
|
||||
>
|
||||
<div style={linkSpacingStyle}>
|
||||
{generateIconComponent(node.superBlock, 'map-icon')}
|
||||
|
Reference in New Issue
Block a user