File tree 7 files changed +64
-1
lines changed
7 files changed +64
-1
lines changed Original file line number Diff line number Diff line change
1
+ examples /* .rkt.js
2
+ /node_modules /
3
+ /build
Original file line number Diff line number Diff line change @@ -5,16 +5,24 @@ RUN apt-get update -y --allow-releaseinfo-change \
5
5
&& apt-get install -y --no-install-recommends xz-utils make \
6
6
&& apt-get clean
7
7
8
+ RUN apt-get -y install git
9
+
8
10
WORKDIR /app
9
11
RUN curl -O https://nodejs.org/dist/v18.16.0/node-v18.16.0-linux-x64.tar.xz
10
12
RUN tar xvf node-v18.16.0-linux-x64.tar.xz -C .
11
13
ENV PATH="/app/node-v18.16.0-linux-x64/bin:${PATH}"
12
14
RUN npm install -g js-beautify
13
15
14
16
COPY . /app/racketscript-playground
17
+ RUN cd racketscript-playground && npm install
18
+
15
19
ENV PATH="/root/.local/share/racket/8.7/bin/:${PATH}"
16
20
RUN raco pkg install --auto racketscript
17
21
22
+ RUN git clone https://github.com/leiDnedyA/rackt \
23
+ && cd rackt && git checkout cdn-import \
24
+ && raco pkg install
25
+
18
26
WORKDIR /app/racketscript-playground
19
27
RUN make build || true
20
28
CMD ["make" , "run-forever" ]
Original file line number Diff line number Diff line change
1
+ #lang racketscript/base
2
+
3
+ (require rackt)
4
+
5
+ ;;
6
+ ;; Uses a slightly modified version of the rackt module, a lightweight react wrapper
7
+ ;; for racketscript.
8
+ ;; Check it out @ https://github.com/rackt-org/rackt
9
+ ;;
10
+
11
+ (define root (#js*.document.createElement #js"div " ))
12
+ ($/:= #js.root.id #js"root " )
13
+ (#js*.document.body.appendChild root)
14
+
15
+ (define (header props ..)
16
+ (<el "div "
17
+ (<el "h1 " "React Counter Example " )
18
+ (<el "p " "A simple counter demo using "
19
+ (<el "a " "rackt "
20
+ #:props ($/obj [href "https://github.com/rackt-org/rackt " ]))
21
+ ", a react wrapper for racketscript. " )))
22
+
23
+ (define (counter props ..)
24
+ (define-values (counter set-counter) (use-state 0 ))
25
+
26
+ (<el "div "
27
+ (<el header)
28
+ (<el "button "
29
+ #:props ($/obj [ className "button " ]
30
+ [ type "button " ]
31
+ [onClick (lambda (_ ) (set-counter (- counter 1 )))])
32
+ "- 1 " )
33
+
34
+ (<el "span " #:props ($/obj [ className "counter " ]) counter)
35
+
36
+ (<el "button "
37
+ #:props ($/obj [ className "button " ]
38
+ [ type "button " ]
39
+ [onClick (lambda (_ ) (set-counter (+ counter 1 )))])
40
+ "+ 1 " )))
41
+
42
+ (render (<el counter) "root " )
Original file line number Diff line number Diff line change 78
78
< li > < a class ="dropdown-item " href ="#example/tetris "> Tetris</ a > </ li >
79
79
< li > < a class ="dropdown-item " href ="#example/archery "> Archery</ a > </ li >
80
80
< li > < a class ="dropdown-item " href ="#example/wordle "> Wordle</ a > </ li >
81
+ < li > < a class ="dropdown-item " href ="#example/rackt-counter "> React Counter</ a > </ li >
81
82
</ ul >
82
83
</ li >
83
84
Original file line number Diff line number Diff line change 10
10
window . parent . postMessage ( 'run-iframe-init' , window . location . origin ) ;
11
11
} ) ;
12
12
</ script >
13
+
14
+ < script crossorigin src ="https://unpkg.com/react@18/umd/react.development.js "> </ script >
15
+ < script crossorigin src ="https://unpkg.com/react-dom@18/umd/react-dom.development.js "> </ script >
13
16
</ head >
14
17
15
18
< body >
Original file line number Diff line number Diff line change
1
+ ../build/runtime/rackt
Original file line number Diff line number Diff line change 5
5
(require racketscript/interop
6
6
racketscript/browser
7
7
racketscript/htdp/image
8
- racketscript/htdp/universe)
8
+ racketscript/htdp/universe
9
+ rackt)
9
10
10
11
;; interop
11
12
assoc->object
@@ -55,3 +56,7 @@ vector-member
55
56
56
57
;; string
57
58
string-contains?
59
+
60
+ ;; rackt
61
+ <el
62
+ render
You can’t perform that action at this time.
0 commit comments