@@ -72,7 +72,7 @@ provide the templating for creating an input powered by the
7272``` {r}
7373# Create the R package
7474usethis::create_package("~/colorpicker")
75- # Inject the widget templating
75+ # Scaffold initial input implementation files
7676withr::with_dir(
7777 "~/colorpicker",
7878 reactR::scaffoldReactShinyInput("colorpicker", list("react-color" = "^2.17.0"), edit = FALSE)
@@ -83,7 +83,7 @@ withr::with_dir(
8383
8484### Building the JavaScript
8585
86- The next step is to navigate to the newly-created ` sparklines ` project and run
86+ The next step is to navigate to the newly-created ` colorpicker ` project and run
8787the following commands in the terminal:
8888
8989```
@@ -98,8 +98,8 @@ yarn run webpack
9898 documentation on ` yarn install ` , see the [ yarn
9999 documentation] ( https://yarnpkg.com/lang/en/docs/cli/install/ ) .
100100
101- * ` yarn run webpack ` compiles the [ ES2015 ] ( https://babeljs.io/docs/en/learn/ )
102- JavaScript source file at ` srcjs/colorpicker.jsx ` into
101+ * ` yarn run webpack ` compiles the [ modern JavaScript ] ( https://babeljs.io/docs/en/babel-preset-env )
102+ with [ JSX ] ( https://babeljs.io/docs/en/babel-preset-react ) source file at ` srcjs/colorpicker.jsx ` into
103103 ` www/colorpicker/colorpicker/colorpicker.js ` . The latter file is the one
104104 actually used by the R package and includes all the relevant JavaScript
105105 dependencies in a dialect of JavaScript that most browsers understand.
@@ -120,7 +120,7 @@ devtools::document()
120120devtools::install(quick = TRUE)
121121```
122122
123- Alternatively, in RStudio, you can use the keyboard shortcuts ` Ctrl+Shift+D ` and
123+ In RStudio, you can use the keyboard shortcuts ` Ctrl+Shift+D ` and
124124` Ctrl-Shift-B ` to document and build the package. (On macOS, the shortcuts are
125125` Cmd+Shift+D ` and ` Cmd+Shift+B ` )
126126
@@ -133,15 +133,15 @@ run `app.R` to see a demo in action:
133133shiny::runApp()
134134```
135135
136- Alternatively, in RStudio, you can open ` app.R ` and press ` Ctrl-Shift-Enter `
136+ In RStudio, you can open ` app.R ` and press ` Ctrl-Shift-Enter `
137137(` Cmd-Shift-Enter ` on macOS). You should see something like the following appear
138138in the Viewer pane:
139139
140140![ ] ( ./input_app.jpg )
141141
142142## Authoring a React input
143143
144- At this point, we've built some scaffolding for an input powered by React .
144+ At this point, we have a working (if simple) React- powered text input .
145145Let's modify it to create an interface to the ` react-color ` library.
146146
147147### Connecting Shiny with React
@@ -177,7 +177,8 @@ take](http://casesandberg.github.io/react-color/#api) the following
177177 color, that will be called when the new color is selected
178178
179179These operations are conceptually similar enough to the API expected of Shiny
180- inputs that ` reactR ` can assist with mapping components to inputs.
180+ inputs that ` reactR ` can assist with integrating React components into Shiny
181+ as inputs.
181182
182183It does so by introducing a convention for wrapping components like those
183184provided by ` react-color ` with an intermediate component that accepts these
@@ -234,7 +235,7 @@ package.
234235After rebuilding the JavaScript and the package, try running ` app.R ` again. You
235236should see something like this:
236237
237- ![ ] ( ./input_sketchpicker_working.jpg )
238+ ![ ] ( ./input_sketchpicker.gif )
238239
239240When you select new colors, you should see the ` textOutput ` update accordingly.
240241
0 commit comments