Skip to content

Add width_percent and height_percent optional inputs to tile functions#22

Merged
DataStrategist merged 3 commits intomasterfrom
copilot/fix-19
Aug 14, 2025
Merged

Add width_percent and height_percent optional inputs to tile functions#22
DataStrategist merged 3 commits intomasterfrom
copilot/fix-19

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Aug 14, 2025

This PR adds convenient width_percent and height_percent parameters to all TileMaker tile functions, addressing common flexdashboard layout challenges.

Problem

Previously, users had to manually write CSS style strings to control tile dimensions:

# Old way - manual CSS
solo_box(value = 100, txt = "Sales", style = "width: 32%; height: 80%;")

This was especially problematic in flexdashboard setups where:

  • height_percent is needed when button text wrapping makes rows uneven
  • width_percent is needed to make buttons fill rows equally (e.g., 3 buttons at 32% width each)

Solution

Added optional width_percent and height_percent parameters to all tile functions:

  • solo_box()
  • solo_gradient_box()
  • solo_box_ct()
  • multi_box()

Usage

# New way - simple percentage parameters
solo_box(value = 100, txt = "Sales", width_percent = 32, height_percent = 80)

# Three equal-width buttons filling a row
solo_box(value = 100, txt = "Sales", width_percent = 32)
solo_box(value = 85, txt = "Marketing", width_percent = 32)  
solo_box(value = 92, txt = "Support", width_percent = 32)

# Control height when text wrapping affects layout
solo_box(value = 150, txt = "Long descriptive text", height_percent = 90)

# Flexible input - accepts numbers or strings with %
solo_box(value = 42, txt = "Test", width_percent = 50)      # number
solo_box(value = 42, txt = "Test", width_percent = "50%")   # string

Implementation Details

  • Automatically generates CSS width and height properties
  • Handles both numeric (50) and string ("50%") input formats
  • Combines properly with existing styling (cursor pointer for links)
  • Maintains full backward compatibility
  • Comprehensive test coverage for all functions and scenarios

Fixes #19.

Warning

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • cloud.r-project.org
    • Triggering command: /usr/lib/R/bin/exec/R -e .libPaths('~/R-libs');~+~install.packages(c('testthat',~+~'htmltools',~+~'purrr',~+~'dplyr',~+~'rlang',~+~'tibble'),~+~repos='REDACTED') (dns block)
  • esm.ubuntu.com
    • Triggering command: /usr/lib/apt/methods/https (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits August 14, 2025 22:47
Co-authored-by: DataStrategist <8094091+DataStrategist@users.noreply.github.com>
Co-authored-by: DataStrategist <8094091+DataStrategist@users.noreply.github.com>
Copilot AI changed the title [WIP] Create percent of element optional inputs Add width_percent and height_percent optional inputs to tile functions Aug 14, 2025
Copilot AI requested a review from DataStrategist August 14, 2025 22:50
@DataStrategist DataStrategist marked this pull request as ready for review August 14, 2025 22:55
@DataStrategist DataStrategist merged commit a4ea64d into master Aug 14, 2025
@DataStrategist DataStrategist deleted the copilot/fix-19 branch August 14, 2025 22:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create percent of element optional inputs

2 participants