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

feat: add CSS reset & update styles accordingly #24

Merged
merged 2 commits into from
Dec 15, 2024

Conversation

cernymatej
Copy link
Contributor

@cernymatej cernymatej commented Dec 14, 2024

This PR adds a CSS reset (by Tailwind) to unify styles across browsers.
I've updated things affected by the reset to match the layout rendered in Chromium browsers. Some minor layout differences may be present, though.

This also eliminates the scroll overflow issue on the index page (body had a margin and thus would cause overflow in combination with min-h-screen)

Summary by CodeRabbit

  • New Features

    • Enhanced visual styling across various components, including improved headings and margins.
    • Added CSS reset for compatibility with Tailwind CSS.
    • Introduced new colour themes for better visual consistency.
  • Bug Fixes

    • Adjusted UI elements for improved layout and readability.
  • Documentation

    • Updated configuration to reflect new styling options and themes.

Copy link

coderabbitai bot commented Dec 14, 2024

Warning

There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure.

🔧 eslint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

app/app.vue

Oops! Something went wrong! :(

ESLint: 9.16.0

Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/.nuxt/eslint.config.mjs' imported from /eslint.config.js
at finalizeResolution (node:internal/modules/esm/resolve:257:11)
at moduleResolve (node:internal/modules/esm/resolve:914:10)
at defaultResolve (node:internal/modules/esm/resolve:1038:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:557:12)
at ModuleLoader.resolve (node:internal/modules/esm/loader:525:25)
at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:246:38)
at ModuleJob._link (node:internal/modules/esm/module_job:126:49)

Walkthrough

The pull request introduces styling and configuration updates across multiple files in a Nuxt.js application. The changes primarily focus on enhancing the visual design by adding new CSS classes, modifying header styles, and introducing a custom colour palette. The Nuxt configuration has been updated to include a CSS reset and define new 'shark' colour shades. The modifications affect page layouts, headings, and overall application theming without significantly altering the core functionality of the components.

Changes

File Change Summary
app/app.vue - Added useHead to set body attributes
- Updated margin and font styles for main and h1 elements
- Removed <style> block
app/pages/[owner]/[repo]/[issue].vue - Enhanced <h2> styling with margin, font weight, and size classes
app/pages/[owner]/[repo]/index.vue - Updated header and label styles
- Modified button and list item spacing
app/pages/index.vue - Adjusted button padding
- Added width and colour to horizontal rule
- Modified repository list spacing
nuxt.config.ts - Added CSS reset import
- Introduced 'shark' colour palette with 5 shades

Poem

🐰 A rabbit's tale of design delight,
Shark-coloured pages, styling so bright!
Margins and classes, a pixel-perfect dance,
Nuxt config singing a stylish romance.
Code refactored with whimsical flair! 🎨

Tip

CodeRabbit's docstrings feature is now available as part of our Early Access Program! Simply use the command @coderabbitai generate docstrings to have CodeRabbit automatically generate docstrings for your pull request. This feature will be included in our Pro Plan when released.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 409a1a2 and 4dd3680.

📒 Files selected for processing (1)
  • app/app.vue (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • app/app.vue

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (3)
app/app.vue (1)

2-6: Consider extracting body classes to a constant

The body styling classes could be moved to a constant for better maintainability and reuse across the application.

+const bodyClasses = 'bg-shark-500 text-white'
+
 useHead({
     bodyAttrs: {
-        class: 'bg-shark-500 text-white',
+        class: bodyClasses,
     },
 })
app/pages/[owner]/[repo]/[issue].vue (1)

17-17: Consider extracting heading styles to a component

The heading styles are duplicated across multiple h2 elements. Consider creating a reusable heading component to maintain consistency.

Example implementation:

<!-- components/BaseHeading.vue -->
<template>
  <h2 class="flex items-center my-4 font-bold text-2xl">
    <slot />
  </h2>
</template>

Usage:

-<h2 class="flex items-center my-4 font-bold text-2xl">
+<BaseHeading>
   <span class="text-gray-500 inline-block mr-1 font-normal">#</span>
   {{ issues[0]?.title }}
-</h2>
+</BaseHeading>

Also applies to: 31-31

app/pages/index.vue (1)

34-34: Button styling looks good, consider adding aria-label

The button styling is well-structured with proper hover, focus, and transition states. The colour contrast ratio appears sufficient for accessibility.

Consider adding an aria-label to provide more context for screen readers, especially since this is a primary action button.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 23a9fa9 and 409a1a2.

⛔ Files ignored due to path filters (2)
  • package.json is excluded by !package.json, !**/package.json
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml, !pnpm-lock.yaml
📒 Files selected for processing (5)
  • app/app.vue (2 hunks)
  • app/pages/[owner]/[repo]/[issue].vue (2 hunks)
  • app/pages/[owner]/[repo]/index.vue (6 hunks)
  • app/pages/index.vue (2 hunks)
  • nuxt.config.ts (2 hunks)
🔇 Additional comments (9)
app/app.vue (1)

18-18: Verify margin changes don't affect mobile layouts

The margin increase from m-2 to m-4 and addition of my-4 to headings could impact mobile layouts. Please ensure these changes maintain proper spacing on smaller screens.

Also applies to: 20-20

✅ Verification successful

Margin changes are properly handled with responsive design

The codebase shows consistent use of responsive design patterns. The margin changes from m-2 to m-4 appear safe because:

  • The main layout uses flexbox (flex flex-col) which provides responsive behaviour
  • Other components properly implement responsive margins using breakpoints (e.g., md:gap-8, md:mt-36)
  • The mobile-first approach is evident with smaller base values that scale up at larger breakpoints
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for any responsive margin adjustments that might conflict
rg -l 'm-(2|4)' | xargs rg 'sm:|md:|lg:|xl:|2xl:'

Length of output: 51


Script:

#!/bin/bash
# Let's search for any responsive utility classes in the entire codebase
rg -A 2 -B 2 'sm:|md:|lg:|xl:|2xl:'

# Also search for any margin-related classes in app.vue specifically
rg -A 2 -B 2 'm-[0-9]' app/app.vue

Length of output: 4869

nuxt.config.ts (2)

75-83: Verify colour contrast ratios for accessibility

The new shark colour palette should be tested for WCAG compliance, particularly for text contrast ratios. The darkest shade (#202830) appears to be the primary background colour.

Consider using a colour contrast checker tool to verify these combinations meet WCAG 2.1 Level AA standards, particularly:

  • Text colours against shark-500 (#202830)
  • Interactive elements using shark-100 through shark-400

22-24: Verify CSS reset impact on existing components

The addition of Tailwind's CSS reset might affect existing component styles. Please ensure all components have been tested, particularly those with custom styling.

✅ Verification successful

CSS reset implementation appears safe with existing styles

The codebase exclusively uses Tailwind utility classes for styling, with no raw CSS styles that could conflict with the reset. All margin, padding, border, and font styles are applied through Tailwind classes (e.g., my-4, px-2, border-solid, font-bold), which are designed to work with Tailwind's reset CSS. The reset will provide a clean foundation without disrupting the existing styling.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for potential style conflicts
rg -l 'style|class' | xargs rg '(margin|padding|border|font)'

Length of output: 4388

app/pages/index.vue (2)

47-47: LGTM: Horizontal rule styling enhances visual hierarchy

The constrained width and consistent colour choice improve the visual separation whilst maintaining the design system's colour palette.


53-53: LGTM: Improved gap control for better layout

The separate horizontal and vertical gaps provide better control over the layout spacing, resulting in improved visual density.

app/pages/[owner]/[repo]/index.vue (4)

38-40: LGTM: Consistent heading styles

The margin and font weight choices provide appropriate visual hierarchy without overpowering the surrounding elements.


Line range hint 80-84: LGTM: Well-structured loading state

The loading state maintains visual consistency with the loaded state whilst providing clear feedback through animation.


129-129: LGTM: Secondary button styling

The reduced text size appropriately differentiates this as a secondary action, whilst maintaining proper interactive states.


53-53: Consider colour contrast for small text

The text-xs size works well for the form aesthetics, but ensure the colour contrast meets WCAG guidelines for small text (4.5:1).

Copy link
Owner

@danielroe danielroe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you ❤️

@danielroe danielroe merged commit 84bea42 into danielroe:main Dec 15, 2024
6 checks passed
@cernymatej cernymatej deleted the feat-css-reset branch December 15, 2024 13:50
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.

2 participants