Skip to content
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 'px' units to relative sizes and use 'rem' for font-sizes #318

Open
coderabbitai bot opened this issue Nov 30, 2024 · 2 comments
Open

Update 'px' units to relative sizes and use 'rem' for font-sizes #318

coderabbitai bot opened this issue Nov 30, 2024 · 2 comments
Assignees

Comments

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 30, 2024

As discussed in PR #317, we need to check where we are using 'px' and update them to use relative sizes with TailwindCSS classes. We should always use 'rem' on font-sizes.

Requested by @AndlerRL.

Reference comment: #317 (comment)

@AndlerRL
Copy link
Member

@coderabbitai can you run an analysis to check where we are using PX values?

Copy link
Contributor Author

coderabbitai bot commented Nov 30, 2024

Tip

For best results, initiate chat on the files or code changes.

@AndlerRL, I've analyzed the codebase for pixel (px) values. Here's a summary of where they are being used:

  1. Layout Dimensions and Spacing:
  • Fixed widths: w-[300px], w-[240px], w-[180px], etc.
  • Fixed heights: h-[240px], min-h-[80px], etc.
  • Fixed margins/padding: px-[8px], py-[20px], etc.
  1. Font Sizes:
  • Direct pixel values: text-[24px], text-[16px], text-[11px], etc.
  1. Border Properties:
  • Border widths: border-[3px], border-[2px], etc.
  • Border radius: rounded-[8px], rounded-[6px], etc.
  1. Email Templates:
  • Various inline styles with pixel values for margins, padding, and font sizes
  1. Responsive Breakpoints:
  • In tailwind.config.js: '2xl': '1400px'

Recommendations:

  1. Font Sizes: Replace all text-[Xpx] with Tailwind's relative size classes:

    - text-[24px]
    + text-2xl
  2. Spacing: Use Tailwind's relative spacing scale:

    - px-[8px]
    + px-2
  3. Component Dimensions: Use relative units or viewport units:

    - w-[300px]
    + w-72 // or w-[18rem]
  4. Border Properties: Use Tailwind's default classes:

    - border-[3px]
    + border-[0.1875rem]
  5. Email Templates: Consider using rem units for better accessibility:

    - margin-bottom: 20px
    + margin-bottom: 1.25rem

Would you like me to create a GitHub issue to track these changes? We can break them down into smaller, manageable tasks.

🐰 thoughtfully analyzing the pixel values in your codebase

🔗 Analysis chain

I'll help you analyze where PX values are being used in the codebase. Let me search for these occurrences.


Let me modify the search to use more basic file extensions since some file types aren't recognized.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for px values in CSS/SCSS/Style files and JSX/TSX files
echo "Files containing 'px' values:"
rg -l '\b\d+px\b' --type=css --type=scss --type=jsx --type=tsx

echo -e "\nDetailed matches with context:"
rg -C 2 '\b\d+px\b' --type=css --type=scss --type=jsx --type=tsx

# Also check for inline styles in JS/TS files that might use px
echo -e "\nInline styles with px values:"
rg -C 2 'style=.*\b\d+px\b' --type=js --type=ts --type=jsx --type=tsx

# Check for styled-components or other CSS-in-JS patterns
echo -e "\nCSS-in-JS patterns with px:"
rg -C 2 '`.*\b\d+px\b.*`' --type=js --type=ts --type=jsx --type=tsx

Length of output: 685


Script:

#!/bin/bash
# Search for px values in all relevant file types
echo "Files containing 'px' values:"
rg -l '\b\d+px\b' -g '*.css' -g '*.scss' -g '*.js' -g '*.jsx' -g '*.ts' -g '*.tsx'

echo -e "\nDetailed matches with context:"
rg -C 2 '\b\d+px\b' -g '*.css' -g '*.scss' -g '*.js' -g '*.jsx' -g '*.ts' -g '*.tsx'

# Also check for inline styles with px values
echo -e "\nInline styles with px values:"
rg -C 2 'style=.*\b\d+px\b' -g '*.js' -g '*.jsx' -g '*.ts' -g '*.tsx'

# Check for styled-components or other CSS-in-JS patterns
echo -e "\nCSS-in-JS patterns with px:"
rg -C 2 '`.*\b\d+px\b.*`' -g '*.js' -g '*.jsx' -g '*.ts' -g '*.tsx'

Length of output: 98720

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

No branches or pull requests

1 participant