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

<Callout /> component #21273

Merged
merged 14 commits into from
Jan 13, 2023
Merged

Conversation

teallarson
Copy link
Contributor

@teallarson teallarson commented Jan 11, 2023

What

Antecedent to some of our work in #21074 I've made some improvements (and a rename) to the artist formerly known as <InfoBox />

Screenshot 2023-01-12 at 3 05 39 PM

How

  • The component only takes children and a classname now
  • It uses scss modules instead of styled components now
  • Updated the implementation of the component to included a few needed custom CSS overrides (see WarningBox) and make the icons children rather than props

Recommended reading order

  1. InfoBox.*
  2. others

@octavia-squidington-iv octavia-squidington-iv added the area/frontend Related to the Airbyte webapp label Jan 11, 2023
@teallarson teallarson force-pushed the teal/free-ab-connectors-inline-enrollment-banner branch from a48b2fa to d365f7a Compare January 12, 2023 14:18
@teallarson teallarson force-pushed the teal/free-ab-connectors-inline-enrollment-banner branch from 4825b29 to 2aa84ae Compare January 12, 2023 19:14
@teallarson teallarson changed the title genericize alert component <Callout /> component Jan 12, 2023
@teallarson teallarson marked this pull request as ready for review January 12, 2023 20:18
Copy link
Contributor

@josephkmh josephkmh left a comment

Choose a reason for hiding this comment

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

Looks good, I would just suggest we use semantic names instead of colors for variant. WDYT?

airbyte-webapp/src/components/ui/Callout/Callout.tsx Outdated Show resolved Hide resolved
airbyte-webapp/src/components/ui/Callout/Callout.tsx Outdated Show resolved Hide resolved
[styles.blue]: variant === "blue",
});

return <div className={containerStyles}>{children}</div>;
Copy link
Contributor

Choose a reason for hiding this comment

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

Take it or leave it: should we add a prop for an optional icon? I imagine a lot of callouts have an icon, and that would make it easy to ensure spacing between icon & text (or whatever is in {children}) is consistent.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

IMO no. I took out the existing prop for that as it was only used in 1-2 places.

There is also a spot where I plan on adding a button to a Callout, etc. Once I started considering different ways this might be used, I ended up deciding the important part here is really just the basic container.

I'm more in favor of keeping this very basic and unconcerned with what its children are personally. It does have flex, so it does space out its children consistently by default (which can be overridden by a classname if wanted)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Having said that I just saw one more usage when I rebased.

However, with the move away from FA towards custom icons, we'd likely be passing in a ReactNode or a svg, at which point it feels to me like we may as well just accept it as a child... I could be swayed there though.

Copy link
Contributor

@josephkmh josephkmh Jan 13, 2023

Choose a reason for hiding this comment

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

Fine for me to skip this for now! I think when we do eventually move towards custom icons, we'll still want to enforce sizing constrains so that different <Callout> usages don't have different icon sizes, something like <Callout icon="exclamation-mark">{ ... some text or JSX ... }</Callout>. That would make it type safe and ensure alignments/size/spacing is always the same.

But no need to address that yet - we can probably enforce that later if/when we implement a custom Icon component: #20133

@teallarson
Copy link
Contributor Author

teallarson commented Jan 13, 2023

My reason for taking the semantic names out is that we don't have a consistent pattern for them app-wide currently. I don't feel strongly on it and agree it makes it easier to change theming later.

Addressed in 657236c

Copy link
Contributor

@josephkmh josephkmh left a comment

Choose a reason for hiding this comment

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

Looks great! Approving and crossing my fingers that CI will be green 😅

@teallarson teallarson merged commit fbb317d into master Jan 13, 2023
@teallarson teallarson deleted the teal/free-ab-connectors-inline-enrollment-banner branch January 13, 2023 15:57
jbfbell pushed a commit that referenced this pull request Jan 13, 2023
* genericize alert component

* add className prop to alert

* rename infobox "callout", swap in place for scss module

* fix imports

* use callout in place of alert

* add blue variant, remove icon prop

* remove font-size (this is already the default)

* remove single use prop, use a classname instead

* use semantic names, remove empty line

* cleanup from rebase
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/frontend Related to the Airbyte webapp
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants