Skip to content

Commit 3ede82e

Browse files
refactor office fabric examples and add pivot
1 parent c9ee4b0 commit 3ede82e

File tree

1 file changed

+49
-13
lines changed

1 file changed

+49
-13
lines changed

inst/examples/office-fabric.R

Lines changed: 49 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,27 @@
11
library(htmltools)
22
library(reactR)
3-
library(pipeR)
43

54
fabric <- htmlDependency(
65
name = "office-fabric-ui-react",
7-
version = "0.67.0",
6+
version = "5.23.0",
87
src = c(href="https://unpkg.com/office-ui-fabric-react/dist"),
98
script = "office-ui-fabric-react.js",
109
stylesheet = "css/fabric.min.css"
1110
)
1211

13-
tagList() %>>%
14-
attachDependencies(list(html_dependency_react(),fabric)) %>>%
15-
browsable()
12+
browsable(
13+
tagList(
14+
html_dependency_react(),
15+
fabric
16+
)
17+
)
1618

17-
tagList(
18-
tags$div(id = "app-button"),
19-
tags$script(HTML(babel_transform(
19+
browsable(
20+
tagList(
21+
html_dependency_react(),
22+
fabric,
23+
tags$div(id = "app-button"),
24+
tags$script(HTML(babel_transform(
2025
"
2126
let btn = <div className='ms-BasicButtonsExample'>
2227
<Fabric.Label>Command button</Fabric.Label>
@@ -30,8 +35,39 @@ let btn = <div className='ms-BasicButtonsExample'>
3035
3136
ReactDOM.render(btn, document.querySelector('#app-button'));
3237
"
33-
))),
34-
html_dependency_react(),
35-
fabric
36-
) %>>%
37-
browsable()
38+
)))
39+
)
40+
)
41+
42+
43+
browsable(
44+
tagList(
45+
html_dependency_react(),
46+
fabric,
47+
tags$div(id="pivot-example"),
48+
tags$script(HTML(babel_transform(
49+
"
50+
class PivotBasicExample extends React.Component {
51+
render() {
52+
return (
53+
<div>
54+
<Fabric.Pivot>
55+
<Fabric.PivotItem linkText='My Files'>
56+
<Fabric.Label>Pivot #1</Fabric.Label>
57+
</Fabric.PivotItem>
58+
<Fabric.PivotItem linkText='Recent'>
59+
<Fabric.Label>Pivot #2</Fabric.Label>
60+
</Fabric.PivotItem>
61+
<Fabric.PivotItem linkText='Shared with me'>
62+
<Fabric.Label>Pivot #3</Fabric.Label>
63+
</Fabric.PivotItem>
64+
</Fabric.Pivot>
65+
</div>
66+
);
67+
}
68+
}
69+
ReactDOM.render(<PivotBasicExample />, document.querySelector('#pivot-example'));
70+
"
71+
)))
72+
)
73+
)

0 commit comments

Comments
 (0)