1- import PropTypes from 'prop-types ' ;
1+ import { type FC } from 'react ' ;
22import { useSelector } from 'react-redux' ;
33import { Button } from '@openedx/paragon' ;
44import { Link } from 'react-router-dom' ;
55
6+ import { DeprecatedReduxState } from '@src/store' ;
7+ import { getCourseId , getSequenceId } from '@src/course-unit/data/selectors' ;
68import UnitIcon from './UnitIcon' ;
7- import { getCourseId , getSequenceId } from '../../data/selectors' ;
89
9- const UnitButton = ( {
10+ interface Props {
11+ unitId : string ;
12+ className ?: string ;
13+ showTitle ?: boolean ;
14+ isActive ?: boolean ;
15+ }
16+
17+ const UnitButton : FC < Props > = ( {
1018 unitId,
1119 className,
12- showTitle,
1320 isActive, // passed from parent (SequenceNavigationTabs)
21+ showTitle = false ,
1422} ) => {
1523 const courseId = useSelector ( getCourseId ) ;
1624 const sequenceId = useSelector ( getSequenceId ) ;
1725
18- const unit = useSelector ( ( state ) => state . models . units [ unitId ] ) ;
26+ const unit = useSelector ( ( state : DeprecatedReduxState ) => state . models . units [ unitId ] ) ;
1927 const { title, contentType } = unit || { } ;
2028
2129 return (
@@ -33,17 +41,4 @@ const UnitButton = ({
3341 ) ;
3442} ;
3543
36- UnitButton . propTypes = {
37- className : PropTypes . string ,
38- showTitle : PropTypes . bool ,
39- unitId : PropTypes . string . isRequired ,
40- isActive : PropTypes . bool ,
41- } ;
42-
43- UnitButton . defaultProps = {
44- className : undefined ,
45- showTitle : false ,
46- isActive : false ,
47- } ;
48-
4944export default UnitButton ;
0 commit comments