-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Update examples to use bslib #3963
Conversation
…date runExamples() to use that directory by default
Looking good to so far! I just changed file locations around a bit for better backwards-compatibility reasons. I also suggested a couple small tweaks, and left them unresolved in case you need to make updates elsewhere |
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.
Looks great thanks everyone!
I'd love to see us use consistent and modern code style throughout. I certainly have opinions and am happy to restyle the new examples in a follow up.
In particular, I'd like to follow these rules:
- All arguments to a function are either on the same line or each argument is on a new line.
- Closing braces and parens have the same level of indentation as line containing the opening function call.
# Before
textInput(inputId = "caption",
label = "Caption:",
value = "Data Summary"),
# Input: Selector for choosing dataset ----
selectInput(inputId = "dataset",
label = "Choose a dataset:",
choices = c("rock", "pressure", "cars")),
# After
textInput(
inputId = "caption",
label = "Caption:",
value = "Data Summary"
),
# Input: Selector for choosing dataset ----
selectInput(
inputId = "dataset",
label = "Choose a dataset:",
choices = c("rock", "pressure", "cars")
),
Importantly, this code style matches Python's black formatting rules so it's easier for us to be consistent across languages and projects if we follow it.
legacy <- getOption('shiny.legacy.examples', FALSE) | ||
examplesDir <- if (isTRUE(legacy)) 'examples' else 'shiny' | ||
examplesDir <- system_file(examplesDir, package='shiny') |
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.
@karangattu started working on extending runExample()
to other packages in #3917.
That said, while we're here, I think we should do a very light-weight version of that work and add package = "shiny"
to runExample()
's parameters.
I'll take that in a follow-up PR.
This PR updates
runExample()
to use{bslib}
-powered examples. These new examples are located underinst/shiny
instead ofinst/examples
.To run the old (legacy) examples, set
options(shiny.legacy.examples = TRUE)