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

Add Callout component #225

Merged
merged 3 commits into from
Jun 11, 2024
Merged

Add Callout component #225

merged 3 commits into from
Jun 11, 2024

Conversation

SerhiiTsybulskyi
Copy link
Contributor

PR Checklist

Please check if your PR fulfills the following requirements:

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

[ ] Bugfix
[x] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Documentation content changes
[ ] Other... Please describe:

What is the current behavior?

Issue Number: #50

What is the new behavior?

Does this PR introduce a breaking change?

[ ] Yes
[x] No

Other information

Variants
Screenshot 2024-06-10 at 14 26 43

Custom Icon
Screenshot 2024-06-10 at 14 26 49

Custom Text
Screenshot 2024-06-10 at 14 26 54

Copy link

vercel bot commented Jun 10, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
reablocks-storybook ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 11, 2024 6:25am

Copy link

netlify bot commented Jun 10, 2024

Deploy Preview for reablocks-storybook ready!

Name Link
🔨 Latest commit f5a37a8
🔍 Latest deploy log https://app.netlify.com/sites/reablocks-storybook/deploys/6667ed9a72b5410008729390
😎 Deploy Preview https://deploy-preview-225--reablocks-storybook.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
Member

@amcdnl amcdnl left a comment

Choose a reason for hiding this comment

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

Need to add docs once we release

@ghsteff
Copy link
Contributor

ghsteff commented Jun 10, 2024

an alternative to making a separate component for each variant could be to map the variants to their default icons and also give the ability to override that with the icon prop.

// Callout.tsx

const icons = {
  default: null,
  success: <SuccessIcon />,
  error: <ErrorIcon />,
  warning: <WarningIcon />,
  info: <InfoIcon />
}

and then render the icon like

 {icon ?? icons[variant]}

@SerhiiTsybulskyi
Copy link
Contributor Author

an alternative to making a separate component for each variant could be to map the variants to their default icons and also give the ability to override that with the icon prop.

// Callout.tsx

const icons = {
  default: null,
  success: <SuccessIcon />,
  error: <ErrorIcon />,
  warning: <WarningIcon />,
  info: <InfoIcon />
}

and then render the icon like

 {icon ?? icons[variant]}

I've made solution which you described (but with switch/case for icon) first time, but Austin ask to extract it on several component to make it cleaner, that why I updated it to have several components

@SerhiiTsybulskyi SerhiiTsybulskyi merged commit a0b8b82 into master Jun 11, 2024
7 checks passed
@SerhiiTsybulskyi SerhiiTsybulskyi deleted the callout branch June 11, 2024 06:41
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.

3 participants