88 MultiplePartsCard ,
99 Spacer ,
1010 Text ,
11- VerticalStack ,
1211} from "@python-italia/pycon-styleguide" ;
1312import { useCallback } from "react" ;
1413import { FormattedMessage } from "react-intl" ;
@@ -26,18 +25,19 @@ type Props = {
2625 submission : SubmissionStructure ;
2726} ;
2827
28+ const MAX_MATERIALS = 3 ;
29+
2930export const MaterialsSection = ( {
3031 formState,
3132 getErrors,
32- formOptions,
3333 submission,
3434} : Props ) => {
3535 const materials = formState . values . materials ?? [ ] ;
3636
3737 const onAddFile = useCallback (
38- ( e ) => {
38+ ( e : React . MouseEvent < HTMLButtonElement > ) => {
3939 e . preventDefault ( ) ;
40- if ( materials . length >= 3 ) {
40+ if ( materials . length >= MAX_MATERIALS ) {
4141 return ;
4242 }
4343
@@ -53,9 +53,9 @@ export const MaterialsSection = ({
5353 ) ;
5454
5555 const onAddURL = useCallback (
56- ( e ) => {
56+ ( e : React . MouseEvent < HTMLButtonElement > ) => {
5757 e . preventDefault ( ) ;
58- if ( materials . length >= 3 ) {
58+ if ( materials . length >= MAX_MATERIALS ) {
5959 return ;
6060 }
6161
@@ -152,14 +152,14 @@ export const MaterialsSection = ({
152152 < Button
153153 size = "small"
154154 onClick = { onAddFile }
155- disabled = { materials . length >= 3 }
155+ disabled = { materials . length >= MAX_MATERIALS }
156156 >
157157 < FormattedMessage id = "cfp.materials.addFile" />
158158 </ Button >
159159 < Button
160160 size = "small"
161161 onClick = { onAddURL }
162- disabled = { materials . length >= 3 }
162+ disabled = { materials . length >= MAX_MATERIALS }
163163 >
164164 < FormattedMessage id = "cfp.materials.addURL" />
165165 </ Button >
0 commit comments