Skip to content

Commit

Permalink
Added semantic ui syntactic sugar for: form, fields, field and rexpor…
Browse files Browse the repository at this point in the history
…t for HTML label tab. (#43)

* Other type of author field in DESCRIPTION. (#35)

* Script for cran release (#36)

* Initial script for package release. Camel case for DESCRIPTION title.

* Updated README.md images dir path

* Fix for updated README.md images dir path

* Update bash script

* Fixing release script

* Fixes to script vol.2

* Fixes to script vol.3

* Fixes to script vol. 4

* Fixes for script vol.5

* Repaired requested changes in prepare_package_cran.sh

* Changed solution for wrong directory robustness.

* Fixes after cran release trial.

* Modifying script due to new LICENSE.md file.

* Lexical changes in description section.

* Added semantic ui syntactic sugar for: form, fields, field and rexport for HTML label tab.

* Added syntactic sugar for cards, header and segment.
  • Loading branch information
Filip Stachura authored Sep 25, 2017
1 parent 40393db commit bf1c5ce
Show file tree
Hide file tree
Showing 26 changed files with 354 additions and 35 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
.RData
.Ruserdata
.DS_Store
build
14 changes: 7 additions & 7 deletions DESCRIPTION
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ Package: shiny.semantic
Type: Package
Title: Semantic ui support for Shiny
Version: 0.1.1
Author: Filip Stachura <[email protected]>
Maintainer: Filip Stachura <[email protected]>
Description: Creating great user interface for your Shiny apps
can be a hassle, especialy if you want to work purely in R
Authors@R: person("Filip", "Stachura", email = "[email protected]",
role = c("aut", "cre"))
Description: Creating a great user interface for your Shiny apps
can be a hassle, especially if you want to work purely in R
and don't want to use, for instance HTML templates. This
package add support for powerful UI library Semantic UI -
http://semantic-ui.com/. You can also find support for
universal UI input binding that works with various DOM elements.
package adds support for a powerful UI library Semantic UI -
<http://semantic-ui.com/>. It also supports universal UI input
binding that works with various DOM elements.
BugReports: https://github.com/Appsilon/shiny.semantic/issues
Encoding: UTF-8
LazyData: TRUE
Expand Down
12 changes: 2 additions & 10 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,10 +1,2 @@
The shiny.semantic package as a whole is distributed under MIT license.

The MIT License (MIT)
Copyright (c) 2016 Appsilon Sp. z o.o.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
YEAR: 2016
COPYRIGHT HOLDER: Appsilon Sp. z o.o.
23 changes: 23 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
The MIT License (MIT)
=====================

Copyright © 2016 Appsilon Sp. z o.o.

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
8 changes: 8 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Generated by roxygen2: do not edit by hand

export(dropdown)
export(label)
export(register_search)
export(search_field)
export(search_selection_api)
Expand All @@ -9,8 +10,15 @@ export(semanticPage)
export(shiny_input)
export(shiny_text_input)
export(tabset)
export(uicard)
export(uicards)
export(uifield)
export(uifields)
export(uiform)
export(uiheader)
export(uiicon)
export(uimessage)
export(uirender)
export(uisegment)
import(htmlwidgets)
importFrom(magrittr,"%>%")
102 changes: 102 additions & 0 deletions R/dsl.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,108 @@ uiicon <- function(type = "", ...) {
shiny::tags$i(class = paste(type, "icon"), ...)
}

#' Create Semantic UI header
#'
#' This creates a header with optional icon using Semantic UI styles.
#'
#' @param title Header title
#' @param description Subheader text
#' @param icon Optional icon name
#'
#' @export
uiheader <- function(title, description, icon = NULL) {
shiny::h2(class = "ui header",
if (!is.null(icon)) uiicon(icon),
shiny::div(class = "content", title, shiny::div(class = "sub header", description))
)
}

#' Create Semantic UI cards tag
#'
#' This creates a cards tag using Semantic UI styles.
#'
#' @param ... Other arguments to be added as attributes of the tag (e.g. style, class or childrens etc.)
#' @param class Additional classes to add to html tag.
#'
#' @export
uicards <- function(..., class = "") {
shiny::div(class = paste("ui cards", class), ...)
}

#' Create Semantic UI card tag
#'
#' This creates a card tag using Semantic UI styles.
#'
#' @param ... Other arguments to be added as attributes of the tag (e.g. style, class or childrens etc.)
#' @param class Additional classes to add to html tag.
#'
#' @export
uicard <- function(..., class = "") {
shiny::div(class = paste("ui card", class), ...)
}

#' Create Semantic UI segment
#'
#' This creates a segment using Semantic UI styles.
#'
#' @param ... Other arguments to be added as attributes of the tag (e.g. style, class or childrens etc.)
#' @param class Additional classes to add to html tag.
#'
#' @export
uisegment <- function(..., class = "") {
shiny::div(class = paste("ui segment", class), ...)
}

#' Create Semantic UI form tag
#'
#' This creates a form tag using Semantic UI styles.
#'
#' @param ... Other arguments to be added as attributes of the tag (e.g. style, class or childrens etc.)
#' @param class Additional classes to add to html tag.
#'
#' @export
uiform <- function(..., class = "") {
shiny::tags$form(class = paste("ui form", class),
...
)
}

#' Create Semantic UI fields tag
#'
#' This creates a fields tag using Semantic UI styles.
#'
#' @param ... Other arguments to be added as attributes of the tag (e.g. style, class or childrens etc.)
#' @param class Additional classes to add to html tag.
#'
#' @export
uifields <- function(..., class = "") {
shiny::div(class = paste("fields", class), ...)
}

#' Create Semantic UI field tag
#'
#' This creates a field tag using Semantic UI styles.
#'
#' @param ... Other arguments to be added as attributes of the tag (e.g. style, class or childrens etc.)
#' @param class Additional classes to add to html tag.
#'
#' @export
uifield <- function(..., class = "") {
shiny::div(class = paste("field", class), ...)
}

#' Create HTML label tag
#'
#' This creates a HTML label tag.
#'
#' @param ... Other arguments to be added as attributes of the tag (e.g. style, class or childrens etc.)
#'
#' @export
label <- function(...) {
shiny::tags$label(...)
}


#' Create dropdown Semantic UI component
#'
#' This creates a default dropdown using Semantic UI styles with Shiny input. Dropdown is already initialized
Expand Down
10 changes: 9 additions & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ params:
escape_script: FALSE
---

```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "inst/assets/README_files/figure-markdown_github"
)
```

```{r, echo=FALSE, message=FALSE}
source("readme_assets/ui_demo.R")
Expand All @@ -24,7 +32,7 @@ create_example <- function(code, ...) {

<link href="http://fonts.googleapis.com/css?family=Lato:300,700,300italic|Inconsolata" rel="stylesheet" type="text/css">

<link href='docs/style.css' rel='stylesheet' type='text/css'>
<link href='inst/assets/styles/style.css' rel='stylesheet' type='text/css'>

`r params$repo_name`
===========
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

<link href="http://fonts.googleapis.com/css?family=Lato:300,700,300italic|Inconsolata" rel="stylesheet" type="text/css">

<link href='docs/style.css' rel='stylesheet' type='text/css'>
<link href='inst/assets/styles/style.css' rel='stylesheet' type='text/css'>

shiny.semantic
==============
Expand All @@ -15,14 +15,14 @@ Before
</h2>
<br>

![](README_files/figure-markdown_github/unnamed-chunk-2-1.png)
![](inst/assets/README_files/figure-markdown_githubunnamed-chunk-3-1.png)

<h2>
After
</h2>
<br>

![](README_files/figure-markdown_github/unnamed-chunk-3-1.png)
![](inst/assets/README_files/figure-markdown_githubunnamed-chunk-4-1.png)

<!-- #Basic tutorial article is available on [Appsilon Data Science blog](your_future_art_link). -->
<!-- Live demo link below -->
Expand Down Expand Up @@ -75,7 +75,7 @@ Basic example will look like this:

shinyApp(ui = ui(), server = server)

and will render a simple button. ![](README_files/figure-markdown_github/unnamed-chunk-5-1.png)
and will render a simple button. ![](inst/assets/README_files/figure-markdown_githubunnamed-chunk-6-1.png)

For better understanding it's good to check [Semantic UI documentation.](http://semantic-ui.com/introduction/getting-started.html)

Expand Down Expand Up @@ -159,7 +159,7 @@ Component examples

- **Raised segment with list**

![](README_files/figure-markdown_github/unnamed-chunk-6-1.png) <!--html_preserve-->
![](inst/assets/README_files/figure-markdown_githubunnamed-chunk-7-1.png) <!--html_preserve-->
<pre>
<code class="r">div(class = "ui raised segment", div(class = "ui relaxed divided list", c("Apples",
"Pears", "Oranges") %&gt;% purrr::map(~div(class = "item", uiicon("large github middle aligned"),
Expand All @@ -170,7 +170,7 @@ Component examples
<!--/html_preserve-->
- **Interactive card**

![](README_files/figure-markdown_github/unnamed-chunk-8-1.png) <!--html_preserve-->
![](inst/assets/README_files/figure-markdown_githubunnamed-chunk-9-1.png) <!--html_preserve-->
<pre>
<code class="r">div(class = "ui card", div(class = "content", div(class = "right floated meta", "14h"),
img(class = "ui avatar image", src = "http://semantic-ui.com/images/avatar/large/elliot.jpg"),
Expand Down
2 changes: 1 addition & 1 deletion build_readme.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Small script for generating github readme and github pages.
rm(params)

unlink("README_files/", recursive = TRUE)
unlink("inst/assets/README_files/", recursive = TRUE)
file.remove("docs/index.html")
file.remove("README.md")
rmarkdown::render("README.Rmd", output_format = "github_document", runtime = "static", params = list(escape_script=TRUE))
Expand Down
Loading

0 comments on commit bf1c5ce

Please sign in to comment.