insightsengineering / teal.reporter

Create and preview reports with Shiny modules
https://insightsengineering.github.io/teal.reporter/
Other
8 stars 9 forks source link

[Question]: Placemnet of card_template() function. #225

Closed kartikeyakirar closed 9 months ago

kartikeyakirar commented 9 months ago

What is your question?

To include card labels, the add_card_button_srv function allows you to specify the card_fun along with a label parameter for customizing the card's title and content. This feature enables you to utilize the label shiny input and incorporate it into your card_fun to set the title.

When it comes to teal modules, each module has its own structure for the card_fun, but there are common elements shared across all card_function that can be standardized within a card_templatefunction. You can find an example of this in the following code:

Teal Reporter - card_template function

This card_template function can be further encapsulated to suit specific requirements, as demonstrated here:

Teal Goshawk - customized card_template

The challenge lies in deciding where to place the card_template function, as keeping it within teal.reporter adds teal as a dependent package. Here are a few suggestions:

Option 1: Move the card_template() function to teal as an exported function. Instead of teal.reporter.

Option 2: Create a separate card_template for each module (e.g., tmc, tmg, tmh) to ensure module-specific customization. As done previously.

Option 3: Consider adding teal as a dependency to teal.reporter to retain the card_template function.

Code of Conduct

Contribution Guidelines

Security Policy

kartikeyakirar commented 9 months ago

Card_template() function has been added to teal package. linking PR related to this https://github.com/insightsengineering/teal/pull/933

Edit: this was duplicated task .