1- import React from 'react' ;
2- import PropTypes from 'prop-types' ;
3- import { injectIntl , intlShape } from '@edx/frontend-platform/i18n' ;
1+ import { useIntl } from '@edx/frontend-platform/i18n' ;
2+ import { PluginSlot } from '@openedx/frontend-plugin-framework' ;
43import classNames from 'classnames' ;
5-
6- import messages from './messages' ;
7- import Tabs from '../generic/tabs/Tabs' ;
4+ import React from 'react' ;
85import { CoursewareSearch , CoursewareSearchToggle } from '../course-home/courseware-search' ;
96import { useCoursewareSearchState } from '../course-home/courseware-search/hooks' ;
7+ import Tabs from '../generic/tabs/Tabs' ;
8+
9+ import messages from './messages' ;
10+
11+ interface CourseTabsNavigationProps {
12+ activeTabSlug ?: string ;
13+ className ?: string | null ;
14+ tabs : Array < {
15+ title : string ;
16+ slug : string ;
17+ url : string ;
18+ } > ;
19+ }
1020
1121const CourseTabsNavigation = ( {
12- activeTabSlug, className, tabs, intl,
13- } ) => {
22+ activeTabSlug = undefined ,
23+ className = null ,
24+ tabs,
25+ } :CourseTabsNavigationProps ) => {
1426 const { show } = useCoursewareSearchState ( ) ;
27+ const intl = useIntl ( ) ;
1528
1629 return (
1730 < div id = "courseTabsNavigation" className = { classNames ( 'course-tabs-navigation' , className ) } >
@@ -20,15 +33,15 @@ const CourseTabsNavigation = ({
2033 className = "nav-underline-tabs"
2134 aria-label = { intl . formatMessage ( messages . courseMaterial ) }
2235 >
23- { tabs . map ( ( { url, title, slug } ) => (
36+ < PluginSlot id = "course_tab_links_slot" > { tabs . map ( ( { url, title, slug } ) => (
2437 < a
2538 key = { slug }
2639 className = { classNames ( 'nav-item flex-shrink-0 nav-link' , { active : slug === activeTabSlug } ) }
2740 href = { url }
2841 >
2942 { title }
3043 </ a >
31- ) ) }
44+ ) ) } </ PluginSlot >
3245 </ Tabs >
3346 </ div >
3447 < div className = "course-tabs-navigation__search-toggle" >
@@ -39,20 +52,4 @@ const CourseTabsNavigation = ({
3952 ) ;
4053} ;
4154
42- CourseTabsNavigation . propTypes = {
43- activeTabSlug : PropTypes . string ,
44- className : PropTypes . string ,
45- tabs : PropTypes . arrayOf ( PropTypes . shape ( {
46- title : PropTypes . string . isRequired ,
47- slug : PropTypes . string . isRequired ,
48- url : PropTypes . string . isRequired ,
49- } ) ) . isRequired ,
50- intl : intlShape . isRequired ,
51- } ;
52-
53- CourseTabsNavigation . defaultProps = {
54- activeTabSlug : undefined ,
55- className : null ,
56- } ;
57-
58- export default injectIntl ( CourseTabsNavigation ) ;
55+ export default CourseTabsNavigation ;
0 commit comments