Skip to content

fix: correct default title behavior in alert component when only color is provided #506

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

Merged
merged 1 commit into from
Apr 29, 2025

Conversation

zihanKuang
Copy link
Contributor

Problem

The alert shortcode currently uses the type parameter to determine the styling and default title (e.g., "Danger", "Warning", "Info", "Note"). However, many usages of the alert shortcode in the documentation only specify the color parameter without setting the type parameter.

Cause

  • The current implementation does not dynamically adjust the title based on the color parameter.
  • It assumes that either type is provided, or if not, defaults to "Success" without checking the color.

Solution

In the fallback branch (when no recognized type is provided), I added logic to dynamically set a default title based on the color parameter if no explicit title is provided. The updated logic behaves as follows:

  • Yes, I signed my commits.

Signed-off-by: Zihan Kuang <[email protected]>
Copy link

netlify bot commented Apr 26, 2025

Deploy Preview for bejewelled-pegasus-b0ce81 ready!

Name Link
🔨 Latest commit 3dbf804
🔍 Latest deploy log https://app.netlify.com/sites/bejewelled-pegasus-b0ce81/deploys/680d34aeaaae460008d93360
😎 Deploy Preview https://deploy-preview-506--bejewelled-pegasus-b0ce81.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.

@miacycle miacycle merged commit f7d357a into layer5io:master Apr 29, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants