Skip to content

Commit 4cfaaae

Browse files
use readme.rmd and logo with pkgdown
1 parent 2b5dee5 commit 4cfaaae

File tree

3 files changed

+119
-11
lines changed

3 files changed

+119
-11
lines changed

.Rbuildignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@
1111
^karma\.conf\.js$
1212
^package\.json$
1313
^yarn\.lock$
14+
^README\.Rmd$
15+
logo.svg

README.Rmd

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
---
2+
output: github_document
3+
---
4+
5+
# reactR <img src="logo.svg" align="right" alt="" width="120" />
6+
7+
<!-- README.md is generated from README.Rmd. Please edit that file -->
8+
9+
```{r setup, include = FALSE}
10+
knitr::opts_chunk$set(
11+
collapse = TRUE,
12+
comment = "#>",
13+
fig.path = "man/figures/README-",
14+
out.width = "100%"
15+
)
16+
```
17+
18+
[![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/reactR)](https://cran.r-project.org/package=reactR)
19+
[![Travis-CI Build Status](https://travis-ci.org/react-R/reactR.svg?branch=master)](https://travis-ci.org/react-R/reactR)
20+
21+
22+
# reactR
23+
24+
`reactR` provides a set of convenience functions for using [`React`](https://facebook.github.io/react) in `R` with `htmlwidget` constructor templates and local JavaScript dependencies. The `React` ecosystem is rich with components that can enhance `R` web and Shiny apps. `scaffoldReactWidget()` helps build `htmlwidgets` to integrate these `React` components as `R` `htmlwidgets`. The local dependency functions are modeled after the `html_dependency_*` functions from RStudio's [`rmarkdown`](https://github.com/rstudio/rmarkdown) package.
25+
26+
## Installation
27+
28+
You can install reactR from CRAN with `install.packages("reactR")`. For the development version, please use `devtools` as shown below.
29+
30+
```R
31+
# install.packages("devtools")
32+
devtools::install_github("react-R/reactR")
33+
```
34+
35+
## Creating htmlwidgets with React Components
36+
37+
To wrap a `React` component as an `htmlwidget`, please see the tutorial [htmlwidgets with reactR](https://react-r.github.io/reactR/articles/intro_htmlwidgets.html). Also, there are a variety of examples in the [react-R Github organization](https://github.com/react-R).
38+
39+
## Examples
40+
41+
```R
42+
library(reactR)
43+
library(htmltools)
44+
45+
browsable(tagList(
46+
tags$div(id = "app"),
47+
tags$script(
48+
"
49+
ReactDOM.render(
50+
React.createElement(
51+
'h1',
52+
null,
53+
'Powered by React'
54+
),
55+
document.getElementById('app')
56+
)
57+
"
58+
),
59+
#add core-js first to work in RStudio Viewer
60+
html_dependency_corejs(),
61+
html_dependency_react()
62+
))
63+
```
64+
65+
`reactR` also uses the `V8` package if available to transform `JSX` and `ES2015` code.
66+
67+
```R
68+
library(reactR)
69+
library(htmltools)
70+
71+
browsable(
72+
tagList(
73+
tags$div(id = "app"),
74+
tags$script(
75+
babel_transform('ReactDOM.render(<h1>Powered By React/JSX</h1>,document.getElementById("app"))')
76+
),
77+
# add core-js shim first for React in RStudio Viewer
78+
html_dependency_corejs(),
79+
html_dependency_react()
80+
)
81+
)
82+
```
83+
84+
## Contributing and Code of Conduct
85+
86+
We welcome contributors and would love your participation. Please note that this project is released with a [Contributor Code of Conduct](CONDUCT.md). By participating in this project you agree to abide by the terms.

README.md

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,44 @@
1-
[![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/reactR)](https://cran.r-project.org/package=reactR)
2-
[![Travis-CI Build Status](https://travis-ci.org/react-R/reactR.svg?branch=master)](https://travis-ci.org/react-R/reactR)
31

4-
<img height="150px" alt="react-R logo" src="https://github.com/react-R/reactR/raw/enhancements/assets/logos/reactR-logo.png"/>
2+
# reactR <img src="logo.svg" align="right" alt="" width="120" />
3+
4+
<!-- README.md is generated from README.Rmd. Please edit that file -->
5+
6+
[![CRAN\_Status\_Badge](http://www.r-pkg.org/badges/version/reactR)](https://cran.r-project.org/package=reactR)
7+
[![Travis-CI Build
8+
Status](https://travis-ci.org/react-R/reactR.svg?branch=master)](https://travis-ci.org/react-R/reactR)
59

610
# reactR
711

8-
`reactR` provides a set of convenience functions for using [`React`](https://facebook.github.io/react) in `R` with `htmlwidget` constructor templates and local JavaScript dependencies. The `React` ecosystem is rich with components that can enhance `R` web and Shiny apps. `scaffoldReactWidget()` helps build `htmlwidgets` to integrate these `React` components as `R` `htmlwidgets`. The local dependency functions are modeled after the `html_dependency_*` functions from RStudio's [`rmarkdown`](https://github.com/rstudio/rmarkdown) package.
12+
`reactR` provides a set of convenience functions for using
13+
[`React`](https://facebook.github.io/react) in `R` with `htmlwidget`
14+
constructor templates and local JavaScript dependencies. The `React`
15+
ecosystem is rich with components that can enhance `R` web and Shiny
16+
apps. `scaffoldReactWidget()` helps build `htmlwidgets` to integrate
17+
these `React` components as `R` `htmlwidgets`. The local dependency
18+
functions are modeled after the `html_dependency_*` functions from
19+
RStudio’s [`rmarkdown`](https://github.com/rstudio/rmarkdown) package.
920

1021
## Installation
1122

12-
You can install reactR from CRAN with `install.packages("reactR")`. For the development version, please use `devtools` as shown below.
23+
You can install reactR from CRAN with `install.packages("reactR")`. For
24+
the development version, please use `devtools` as shown below.
1325

14-
```R
26+
``` r
1527
# install.packages("devtools")
1628
devtools::install_github("react-R/reactR")
1729
```
1830

1931
## Creating htmlwidgets with React Components
2032

21-
To wrap a `React` component as an `htmlwidget`, please see the tutorial [htmlwidgets with reactR](https://react-r.github.io/reactR/articles/intro_htmlwidgets.html). Also, there are a variety of examples in the [react-R Github organization](https://github.com/react-R).
33+
To wrap a `React` component as an `htmlwidget`, please see the tutorial
34+
[htmlwidgets with
35+
reactR](https://react-r.github.io/reactR/articles/intro_htmlwidgets.html).
36+
Also, there are a variety of examples in the [react-R Github
37+
organization](https://github.com/react-R).
2238

2339
## Examples
2440

25-
```R
41+
``` r
2642
library(reactR)
2743
library(htmltools)
2844

@@ -46,9 +62,10 @@ browsable(tagList(
4662
))
4763
```
4864

49-
`reactR` also uses the `V8` package if available to transform `JSX` and `ES2015` code.
65+
`reactR` also uses the `V8` package if available to transform `JSX` and
66+
`ES2015` code.
5067

51-
```R
68+
``` r
5269
library(reactR)
5370
library(htmltools)
5471

@@ -67,4 +84,7 @@ browsable(
6784

6885
## Contributing and Code of Conduct
6986

70-
We welcome contributors and would love your participation. Please note that this project is released with a [Contributor Code of Conduct](CONDUCT.md). By participating in this project you agree to abide by the terms.
87+
We welcome contributors and would love your participation. Please note
88+
that this project is released with a [Contributor Code of
89+
Conduct](CONDUCT.md). By participating in this project you agree to
90+
abide by the terms.

0 commit comments

Comments
 (0)