-
Notifications
You must be signed in to change notification settings - Fork 2
Bugfix/32 #42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Bugfix/32 #42
Changes from all commits
1190436
687d808
9a43a60
2aa29cc
d5ddb83
2aea97f
dd98767
b54ace3
b8d7584
cd2f3e3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,25 +31,38 @@ url: https://appsilon.github.io/shiny.emptystate/ | |
|
|
||
| navbar: | ||
| bg: primary | ||
| left: | ||
| - icon: fa-home | ||
| href: index.html | ||
| structure: | ||
| left: [home, tutorials, reference, changelog] | ||
| right: [search, github, twitter, mastodon] | ||
| components: | ||
| home: | ||
| icon: fa-home | ||
| text: "Start" | ||
| - icon: fa-university | ||
| href: articles/use-undraw-drawkit-image.html | ||
| text: "Tutorial" | ||
| - icon: fa-file-code-o | ||
| href: index.html | ||
| tutorials: | ||
| text: Tutorials | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The new article is not a tutorial, but a small guide. Change this to "Articles". |
||
| icon: fa-university | ||
| menu: | ||
| - text: How to Use unDraw/Drawkit Illustrations | ||
| href: articles/use-undraw-drawkit-image.html | ||
| - text: How to use triggered animations | ||
| href: articles/use-toggle-animations.html | ||
| reference: | ||
| icon: fa-file-code-o | ||
| text: "Reference" | ||
| href: reference/index.html | ||
| - icon: fa-newspaper-o | ||
| text: Changelog | ||
| changelog: | ||
| icon: fa-newspaper-o | ||
| text: "Changelog" | ||
| href: news/index.html | ||
| right: | ||
| - icon: fa-github fa-lg | ||
| github: | ||
| icon: fa-github fa-lg | ||
| href: https://github.com/Appsilon/shiny.emptystate | ||
| - icon: fa-twitter fa-lg | ||
| twitter: | ||
| icon: fa-twitter fa-lg | ||
| href: https://twitter.com/Appsilon | ||
| - icon: fab fa-mastodon fa-lg | ||
| mastodon: | ||
| icon: fab fa-mastodon fa-lg | ||
| href: https://fosstodon.org/@appsilon | ||
|
|
||
| home: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -59,6 +59,15 @@ describe("EmptyStateManager", { | |
| expect_null(app$get_html(selector = ".empty-state-content")) | ||
| app$stop() | ||
| }) | ||
|
|
||
| it("checks the empty state component follows slider from id", { | ||
| app <- shinytest2::AppDriver$new(test_slider_app(), name = "slide_tag") | ||
| position_1 <- app$get_html(selector = "#container2") | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not a position, but a full HTML. The variable name is misleading. |
||
| app$click("toggle_pannel") | ||
| position_2 <- app$get_html(selector = "#container2") | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not a position, but a full HTML. The variable name is misleading. |
||
| expect_false(position_1 == position_2) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As you compare the whole HTML, this may be a false positive (some other parts of HTML will change). |
||
| app$stop() | ||
| }) | ||
| }) | ||
|
|
||
| describe("use_empty_state()", { | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,69 @@ | ||||||
| --- | ||||||
| title: "How to use triggered animations" | ||||||
| output: rmarkdown::html_vignette | ||||||
| vignette: > | ||||||
| %\VignetteIndexEntry{How to use triggered animations} | ||||||
| %\VignetteEngine{knitr::rmarkdown} | ||||||
| %\VignetteEncoding{UTF-8} | ||||||
| --- | ||||||
|
|
||||||
| # Introduction | ||||||
|
|
||||||
| `shiny.emptystate` is capable of being used for dynamic positioning trigger animations. This is specially interesting when we have UIs that change position and we want to keep the `emptystate` in the appropriate tag | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
|
||||||
| **Note:** This solution is only available for instant positioning animation. | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please include the solution for the animations, provided in the issue comments. |
||||||
|
|
||||||
| # Animation example | ||||||
|
|
||||||
| The example below showcases the example of using a dynamic trigger slider that changes. | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please explain this in more detail. Also, inform the reader what would happen without the |
||||||
|
|
||||||
| The function `shiny_emptystate_updatePosition` updates the position of the #container1 after being re-positioned | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please make it clear that this function is 1. JS 2. comes with |
||||||
|
|
||||||
| ``` r | ||||||
| library(shiny) | ||||||
| library(shiny.emptystate) | ||||||
|
|
||||||
| ui <- shiny::fillPage( | ||||||
| use_empty_state(), | ||||||
| shiny::actionButton( | ||||||
| "toggle_pannel", | ||||||
| "Toggle panel", | ||||||
| class = "btn btn-primary", | ||||||
| onClick = "$('#container1').toggle(0, | ||||||
| function(){shiny_emptystate_updatePosition('container2')});" | ||||||
| ), | ||||||
| shiny::div( | ||||||
| style = "width: 300px", | ||||||
| class = "d-flex flex-column gap-5", | ||||||
| shiny::div( | ||||||
| id = "container1", | ||||||
| shiny::div( | ||||||
| shiny::h1("Card 1"), | ||||||
| "Card content" | ||||||
| ) | ||||||
| ), | ||||||
| shiny::div( | ||||||
| id = "container2", | ||||||
| shiny::div( | ||||||
| shiny::h1("Card 2"), | ||||||
| "Card content" | ||||||
| ) | ||||||
| ) | ||||||
| ) | ||||||
| ) | ||||||
|
|
||||||
| server = function(input, output) { | ||||||
| empty_state_content <- shiny::div( | ||||||
| "This is example empty state content" | ||||||
| ) | ||||||
| empty_state_manager <- EmptyStateManager$new( | ||||||
| id = "container2", | ||||||
| html_content = empty_state_content | ||||||
| ) | ||||||
| empty_state_manager$show() | ||||||
| } | ||||||
|
|
||||||
| shinyApp(ui, server) | ||||||
| ``` | ||||||
|
|
||||||
|  | ||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please change the name of the function to follow camel case, instead of a weird hybrid.
updateElementPositionshould work here.