Skip to content

Enhanced button animation for more engaging user experience. #3988

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

Conversation

shashank-varshney21
Copy link

@shashank-varshney21 shashank-varshney21 commented Mar 29, 2025

Description

  • Updated button animations to provide a smoother and more responsive interaction.
  • Enhances feedback and reducing delays.
  • Ensures consistency with the overall design and usability standards
  • Passed all the tests.

Screenshot (3)
ScreenRecording.zip

Summary by CodeRabbit

  • Style
    • Enhanced button visuals with a refreshed hover state that now shows a white background and dynamic text color change.
    • Introduced a primary-colored border to provide a more defined and consistent appearance.

Copy link
Contributor

coderabbitai bot commented Mar 29, 2025

Walkthrough

The pull request updates the styling of the button component in Button.tsx. The hover background color has been changed from a darker shade to white, and the text now exhibits a hover effect that transitions to the primary color. Additionally, the button’s CSS classes have been modified to include a border with the primary color. No changes were made to the component's structure or its public declarations.

Changes

File(s) Change Summary
components/buttons/Button.tsx Updated bgClassName to switch the hover background from primary-400 to white, modified textClassName to include a hover text color change to primary-500, and added border-primary-500 border to both button size classes.

Possibly related PRs

Suggested labels

ready-to-merge

Suggested reviewers

  • derberg
  • magicmatatjahu
  • devilkiller-ag
  • akshatnema
  • sambhavgupta0705
  • asyncapi-bot-eve
  • Mayaleeeee

Poem

In a field of code, I hop with cheer,
Making buttons shine, crisp and clear.
Hover hues change at a swift pace,
A bordered charm, a rabbit's grace.
A simple tweak, a joyful hop—
Celebrating code that will never stop!
🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ 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.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @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.

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

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Welcome to AsyncAPI. Thanks a lot for creating your first pull request. Please check out our contributors guide useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.

@asyncapi-bot
Copy link
Contributor

asyncapi-bot commented Mar 29, 2025

We require all PRs to follow Conventional Commits specification.
More details 👇🏼

 No release type found in pull request title "Enhanced button animation for more engaging user experience.". Add a prefix to indicate what kind of release this pull request corresponds to. For reference, see https://www.conventionalcommits.org/

Available types:
 - feat: A new feature
 - fix: A bug fix
 - docs: Documentation only changes
 - style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
 - refactor: A code change that neither fixes a bug nor adds a feature
 - perf: A code change that improves performance
 - test: Adding missing tests or correcting existing tests
 - build: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
 - ci: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
 - chore: Other changes that don't modify src or test files
 - revert: Reverts a previous commit

Copy link

netlify bot commented Mar 29, 2025

Deploy Preview for asyncapi-website ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 6cf98c4
🔍 Latest deploy log https://app.netlify.com/sites/asyncapi-website/deploys/67e846638aace20008e0ceb5
😎 Deploy Preview https://deploy-preview-3988--asyncapi-website.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Contributor

@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: 1

🧹 Nitpick comments (1)
components/buttons/Button.tsx (1)

65-68: Consider a shorter transition duration

The 500ms transition duration might feel slow for a button hover effect. Consider shortening it to 300ms for a more responsive feel unless this duration is standardized across your application.

-  const smallButtonClasses = twMerge(`${bgClassName} ${textClassName} border-primary-500 border transition-all duration-500
+  const smallButtonClasses = twMerge(`${bgClassName} ${textClassName} border-primary-500 border transition-all duration-300
-  const classNames = twMerge(`${bgClassName} ${textClassName} border-primary-500 border transition-all duration-500 ease-in-out
+  const classNames = twMerge(`${bgClassName} ${textClassName} border-primary-500 border transition-all duration-300 ease-in-out
🧰 Tools
🪛 ESLint

[error] 65-65: Insert ⏎···

(prettier/prettier)


[error] 67-67: Insert ⏎···

(prettier/prettier)

🪛 GitHub Actions: PR testing - if Node project

[error] 65-67: Insert ⏎··· prettier/prettier

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f42e537 and 6cf98c4.

📒 Files selected for processing (1)
  • components/buttons/Button.tsx (1 hunks)
🧰 Additional context used
🪛 ESLint
components/buttons/Button.tsx

[error] 65-65: Insert ⏎···

(prettier/prettier)


[error] 67-67: Insert ⏎···

(prettier/prettier)

🪛 GitHub Actions: PR testing - if Node project
components/buttons/Button.tsx

[error] 65-67: Insert ⏎··· prettier/prettier

🔇 Additional comments (2)
components/buttons/Button.tsx (2)

60-61: Improved button interaction styling

The hover effect now reverses the button colors (white background with primary text), which provides better visual feedback to users when interacting with the button, aligning with the PR's goal of enhancing button animations.


60-61:

❓ Verification inconclusive

Verify color contrast for accessibility

Ensure there's sufficient contrast between the primary text color and the white background on hover for accessibility compliance.


🌐 Web query:

What is the recommended color contrast ratio for accessibility between text and background?

💡 Result:

The recommended color contrast ratio for accessibility between text and background depends on the text size and WCAG compliance level, with key guidelines as follows:

Minimum Requirements (WCAG Level AA)

  • Normal text (smaller than 18pt/24px or 14pt/18.67px bold):
    At least 4.5:1 contrast ratio with the background[2][5][6][8][15].
  • Large text (18pt/24px or larger, or 14pt/18.67px bold):
    Minimum 3:1 contrast ratio[2][5][8][15].
  • Non-text elements (UI components, graphics):
    3:1 contrast ratio for interactive states or critical visual information[2][6][11][16].

Enhanced Requirements (WCAG Level AAA)

  • Normal text: At least 7:1 contrast ratio[2][5][12][15].
  • Large text: 4.5:1 contrast ratio[5][15][12].

Exceptions

  • Logos/branding: No minimum requirement[6][7][11].
  • Incidental/decorative text: Exempt from contrast rules[6][7][11].

Best Practices

  • Avoid color-only indicators: Use additional cues like underlines for links or symbols for required fields[1][3].
  • Test with tools: Use validators like WebAIM’s Contrast Checker or Accessible Web’s tools to verify ratios[5][12].
  • Consider user needs: Very high contrast (e.g., pure black on white) may hinder readability for users with dyslexia[4].

For example:

  • Passing combinations: Dark blue (#112e51) on white achieves 4.5:1[1].
  • Failing combinations: Red (#FF0000) on white has a 4:1 ratio, below the 4.5:1 threshold[6].

Always prioritize readability for diverse audiences, including those with low vision or color deficiencies[3][9][15].

Citations:


Action Required: Confirm color contrast meets WCAG guidelines

Please verify that the hover state of the button—where the background switches to white and the text applies the primary-500 color—meets accessibility contrast requirements. Specifically:

  • For normal text, ensure the contrast ratio is at least 4.5:1.
  • For large text, a minimum ratio of 3:1 is required.
  • If adhering to WCAG Level AAA standards, higher contrast ratios (7:1 for normal and 4.5:1 for large text) may be needed.

Consider using tools like WebAIM’s Contrast Checker for validation.

File: components/buttons/Button.tsx (Lines: 60-61)

Comment on lines +65 to 68
const smallButtonClasses = twMerge(`${bgClassName} ${textClassName} border-primary-500 border transition-all duration-500
ease-in-out rounded-md px-3 py-2 text-sm font-medium tracking-heading ${className || ''}`);
const classNames = twMerge(`${bgClassName} ${textClassName} transition-all duration-500 ease-in-out
const classNames = twMerge(`${bgClassName} ${textClassName} border-primary-500 border transition-all duration-500 ease-in-out
rounded-md px-4 py-3 text-md font-semibold tracking-heading ${className || ''}`);
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix formatting issues

The static analysis tool and pipeline tests are failing due to formatting issues. You need to fix the indentation according to prettier rules.

-  const smallButtonClasses = twMerge(`${bgClassName} ${textClassName} border-primary-500 border transition-all duration-500
-                            ease-in-out rounded-md px-3 py-2 text-sm font-medium tracking-heading ${className || ''}`);
-  const classNames = twMerge(`${bgClassName} ${textClassName} border-primary-500 border transition-all duration-500 ease-in-out
-                          rounded-md px-4 py-3 text-md font-semibold tracking-heading ${className || ''}`);
+  const smallButtonClasses = twMerge(
+    `${bgClassName} ${textClassName} border-primary-500 border transition-all duration-500 ease-in-out rounded-md px-3 py-2 text-sm font-medium tracking-heading ${className || ''}`
+  );
+  const classNames = twMerge(
+    `${bgClassName} ${textClassName} border-primary-500 border transition-all duration-500 ease-in-out rounded-md px-4 py-3 text-md font-semibold tracking-heading ${className || ''}`
+  );
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const smallButtonClasses = twMerge(`${bgClassName} ${textClassName} border-primary-500 border transition-all duration-500
ease-in-out rounded-md px-3 py-2 text-sm font-medium tracking-heading ${className || ''}`);
const classNames = twMerge(`${bgClassName} ${textClassName} transition-all duration-500 ease-in-out
const classNames = twMerge(`${bgClassName} ${textClassName} border-primary-500 border transition-all duration-500 ease-in-out
rounded-md px-4 py-3 text-md font-semibold tracking-heading ${className || ''}`);
const smallButtonClasses = twMerge(
`${bgClassName} ${textClassName} border-primary-500 border transition-all duration-500 ease-in-out rounded-md px-3 py-2 text-sm font-medium tracking-heading ${className || ''}`
);
const classNames = twMerge(
`${bgClassName} ${textClassName} border-primary-500 border transition-all duration-500 ease-in-out rounded-md px-4 py-3 text-md font-semibold tracking-heading ${className || ''}`
);
🧰 Tools
🪛 ESLint

[error] 65-65: Insert ⏎···

(prettier/prettier)


[error] 67-67: Insert ⏎···

(prettier/prettier)

🪛 GitHub Actions: PR testing - if Node project

[error] 65-67: Insert ⏎··· prettier/prettier

@akshatnema
Copy link
Member

We don't need such type of animations for buttons.

@akshatnema akshatnema closed this Mar 30, 2025
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.

4 participants