File tree 9 files changed +11129
-0
lines changed
9 files changed +11129
-0
lines changed Original file line number Diff line number Diff line change
1
+ {
2
+ "name" : " parcel-ts" ,
3
+ "version" : " 1.0.0" ,
4
+ "license" : " MIT" ,
5
+ "scripts" : {
6
+ "start" : " parcel src/index.html" ,
7
+ "build" : " parcel build src/index.html" ,
8
+ "test" : " echo \" no tests exists\" "
9
+ },
10
+ "dependencies" : {
11
+ "bootstrap" : " ^5.1.3" ,
12
+ "react" : " ^17.0.2" ,
13
+ "react-bootstrap" : " ^2.0.0" ,
14
+ "react-dom" : " ^17.0.2"
15
+ },
16
+ "devDependencies" : {
17
+ "parcel-bundler" : " ^1.12.5" ,
18
+ "typescript" : " ^4.4.4"
19
+ }
20
+ }
Original file line number Diff line number Diff line change
1
+ <!DOCTYPE html>
2
+ < html lang ="en ">
3
+
4
+ < head >
5
+ </ head >
6
+
7
+ < body >
8
+ < div id ="root "> </ div >
9
+ < script src ="./index.tsx "> </ script >
10
+ </ body >
11
+
12
+ </ html >
Original file line number Diff line number Diff line change
1
+ import React , { useState } from 'react' ;
2
+ import ReactDOM from 'react-dom' ;
3
+
4
+ // Importing the Bootstrap CSS
5
+ import 'bootstrap/dist/css/bootstrap.min.css' ;
6
+
7
+ import Toast from 'react-bootstrap/Toast' ;
8
+ import Container from 'react-bootstrap/Container' ;
9
+ import Button from 'react-bootstrap/Button' ;
10
+
11
+ const ExampleToast : React . FunctionComponent = ( { children } ) => {
12
+ const [ show , toggleShow ] = useState ( true ) ;
13
+
14
+ return (
15
+ < >
16
+ { ! show && < Button onClick = { ( ) => toggleShow ( true ) } > Show Toast</ Button > }
17
+ < Toast show = { show } onClose = { ( ) => toggleShow ( false ) } >
18
+ < Toast . Header >
19
+ < strong className = "mr-auto" > React-Bootstrap</ strong >
20
+ </ Toast . Header >
21
+ < Toast . Body > { children } </ Toast . Body >
22
+ </ Toast >
23
+ </ >
24
+ ) ;
25
+ } ;
26
+
27
+ const App = ( ) => (
28
+ < Container className = "p-3" >
29
+ < Container className = "p-5 mb-4 bg-light rounded-3" >
30
+ < h1 className = "header" > Welcome To React-Bootstrap</ h1 >
31
+ < ExampleToast >
32
+ We now have Toasts
33
+ < span role = "img" aria-label = "tada" >
34
+ 🎉
35
+ </ span >
36
+ </ ExampleToast >
37
+ </ Container >
38
+ </ Container >
39
+ ) ;
40
+
41
+ const mountNode = document . getElementById ( 'root' ) ;
42
+ ReactDOM . render ( < App /> , mountNode ) ;
Original file line number Diff line number Diff line change
1
+ {
2
+ "compilerOptions" : {
3
+ "jsx" : " react" ,
4
+ "esModuleInterop" : true
5
+ }
6
+ }
Load Diff Large diffs are not rendered by default.
Original file line number Diff line number Diff line change
1
+ {
2
+ "name" : " parcel" ,
3
+ "version" : " 1.0.0" ,
4
+ "license" : " MIT" ,
5
+ "scripts" : {
6
+ "start" : " parcel src/index.html" ,
7
+ "build" : " parcel build src/index.html" ,
8
+ "test" : " echo \" no tests exists\" "
9
+ },
10
+ "dependencies" : {
11
+ "bootstrap" : " ^5.1.3" ,
12
+ "react" : " ^17.0.2" ,
13
+ "react-bootstrap" : " ^2.0.0" ,
14
+ "react-dom" : " ^17.0.2"
15
+ },
16
+ "devDependencies" : {
17
+ "parcel-bundler" : " ^1.12.5"
18
+ }
19
+ }
Original file line number Diff line number Diff line change
1
+ <!DOCTYPE html>
2
+ < html lang ="en ">
3
+ < head >
4
+ </ head >
5
+ < body >
6
+ < div id ="root "> </ div >
7
+ < script src ="./index.js "> </ script >
8
+ </ body >
9
+ </ html >
Original file line number Diff line number Diff line change
1
+ import React , { useState } from 'react' ;
2
+ import ReactDOM from 'react-dom' ;
3
+
4
+ // Importing the Bootstrap CSS
5
+ import 'bootstrap/dist/css/bootstrap.min.css' ;
6
+
7
+ import Toast from 'react-bootstrap/Toast' ;
8
+ import Container from 'react-bootstrap/Container' ;
9
+ import Button from 'react-bootstrap/Button' ;
10
+
11
+ const ExampleToast = ( { children } ) => {
12
+ const [ show , toggleShow ] = useState ( true ) ;
13
+
14
+ return (
15
+ < React . Fragment >
16
+ { ! show && < Button onClick = { ( ) => toggleShow ( true ) } > Show Toast</ Button > }
17
+ < Toast show = { show } onClose = { ( ) => toggleShow ( false ) } >
18
+ < Toast . Header >
19
+ < strong className = "mr-auto" > React-Bootstrap</ strong >
20
+ </ Toast . Header >
21
+ < Toast . Body > { children } </ Toast . Body >
22
+ </ Toast >
23
+ </ React . Fragment >
24
+ ) ;
25
+ } ;
26
+
27
+ const App = ( ) => (
28
+ < Container className = "p-3" >
29
+ < Container className = "p-5 mb-4 bg-light rounded-3" >
30
+ < h1 className = "header" > Welcome To React-Bootstrap</ h1 >
31
+ < ExampleToast >
32
+ We now have Toasts
33
+ < span role = "img" aria-label = "tada" >
34
+ 🎉
35
+ </ span >
36
+ </ ExampleToast >
37
+ </ Container >
38
+ </ Container >
39
+ ) ;
40
+
41
+ var mountNode = document . getElementById ( 'root' ) ;
42
+ ReactDOM . render ( < App /> , mountNode ) ;
You can’t perform that action at this time.
0 commit comments