# devtools::install_github("jpmarindiaz/isotope")
library(isotope)

d <- read.csv(system.file("data/htmlwidgets-gallery.csv", package="isotope"),stringsAsFactors = FALSE)
d <- d[c('tags','release','author','jsLibIds','name','thumbnail')]
filterCols <- c('tags','release','author','jsLibIds')
sortCols <- c("name","author")

tpl <- '
<div class="myItem">
  <h3 class="name background"><span>{{name}}</span></h3>
  <div class="container">
    <div>
      <img src={{thumbnail}} width="100%"/>
    </div>
    <p class="url"><small><a href="{{url}}">Go to project page!</a></small></p>
    <p class="author"> <strong>Author:</strong> <a href="http://github.com/{{author}}">{{author}}</a> </p>
    <p><strong>Tags:</strong>{{tags}}</p>
    <div class="jsLibIds"><em>JS Libraries:</em> {{jsLibIds}}</div>
  </div>
</div>
'

css <- '
.myItem{
  margin:5px;
  border: 1px solid rgb(108, 136, 186);
}
.container {
  background: #fafafa;
  padding: 10px;
}
.myItem h3{
margin: 0px;
text-align: center;
background-color: rgb(108, 136, 186);
color: white
}
a {
    color: rgb(108, 136, 186);
}


'

isotope(d, filterCols = filterCols, sortCols = sortCols, elemTpl = tpl, style = css)

s <- isotope(d, filterCols = filterCols, sortCols = sortCols, elemTpl = tpl, style = css) 
saveWidget(s,"index.html")


jpmarindiaz/isotope documentation built on May 19, 2019, 11:49 p.m.