@@ -2,84 +2,53 @@ import { useContext } from 'react';
22import { LIBRARIES } from 'helpers/const' ;
33import { AppContext } from 'context/AppContext' ;
44import { AppAactions } from 'context/Reducer' ;
5+ import Modal from 'components/Modal' ;
56
67const About : React . FC = ( ) => {
78 const { state, dispatch } = useContext ( AppContext ) ;
89
10+ const open = state . display !== 'none' ;
11+
12+ const handleClose = ( ) => {
13+ dispatch ( { type : AppAactions . TOGGLE_ABOUT_MODAL , payload : 'none' } ) ;
14+ } ;
15+
916 return (
10- < div >
11- < div
12- data-testid = "about-main-container"
13- className = "modal fade show"
14- style = { { display : state . display } }
15- >
16- < div className = "modal-dialog" >
17- < div className = "modal-content" >
18- < div className = "modal-header" >
19- < h4 className = "modal-title" > About JS Playground</ h4 >
20- </ div >
21- < div className = "modal-body" >
22- < p >
23- JS Playground is an experimental JavaScript PlayGround created
24- for Education and Testing Purposes
25- </ p >
26- < div >
27- This sandbox playground is hooked up directly with
28- < ul data-testid = "about-libraries-list" >
29- { LIBRARIES . map ( lib => (
30- < li key = { lib . name } >
31- < div
32- style = { {
33- display : 'flex' ,
34- flex : 1 ,
35- justifyContent : 'space-between' ,
36- } }
37- >
38- < a
39- href = { lib . url }
40- target = "_blank"
41- rel = "noopener noreferrer"
42- >
43- { lib . name } { ' ' }
44- < span className = "text-sm" > v{ lib . version } </ span >
45- </ a >
46- < span > Use as { lib . use } </ span >
47- </ div >
48- </ li >
49- ) ) }
50- </ ul >
51- </ div >
52- < p > Enjoy</ p >
53- < div >
54- < div className = "float-left" >
55- < a
56- href = "https://nyala.dev"
57- target = "_blank"
58- rel = "noopener noreferrer"
59- >
60- Khalid Elshafie
61- </ a >
62- </ div >
63- </ div >
64- </ div >
65- < div className = "modal-footer" >
66- < button
67- type = "button"
68- className = "btn btn-primary"
69- onClick = { ( ) =>
70- dispatch ( {
71- type : AppAactions . TOGGLE_ABOUT_MODAL ,
72- payload : 'none' ,
73- } )
74- }
17+ < Modal isOpen = { open } onClose = { handleClose } title = "About JS Playground" >
18+ < p >
19+ JS Playground is an experimental JavaScript PlayGround created for
20+ Education and Testing Purposes
21+ </ p >
22+ < div >
23+ This sandbox playground is hooked up directly with
24+ < ul data-testid = "about-libraries-list" >
25+ { LIBRARIES . map ( lib => (
26+ < li key = { lib . name } >
27+ < div
28+ style = { {
29+ display : 'flex' ,
30+ flex : 1 ,
31+ justifyContent : 'space-between' ,
32+ } }
7533 >
76- Close
77- </ button >
78- </ div >
79- </ div >
34+ < a href = { lib . url } target = "_blank" rel = "noopener noreferrer" >
35+ { lib . name } < span className = "text-sm" > v{ lib . version } </ span >
36+ </ a >
37+ < span > Use as { lib . use } </ span >
38+ </ div >
39+ </ li >
40+ ) ) }
41+ </ ul >
42+ </ div >
43+ < p > Enjoy</ p >
44+ < div >
45+ < div className = "float-left" >
46+ < a href = "https://nyala.dev" target = "_blank" rel = "noopener noreferrer" >
47+ Khalid Elshafie
48+ </ a >
8049 </ div >
8150 </ div >
82- </ div >
51+ </ Modal >
8352 ) ;
8453} ;
8554
0 commit comments