-
Notifications
You must be signed in to change notification settings - Fork 14k
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
refactor: Bootstrap to AntD - Alert #12122
refactor: Bootstrap to AntD - Alert #12122
Conversation
Codecov Report
@@ Coverage Diff @@
## master #12122 +/- ##
===========================================
+ Coverage 53.06% 73.01% +19.95%
===========================================
Files 489 553 +64
Lines 17314 20359 +3045
Branches 4482 5332 +850
===========================================
+ Hits 9187 14866 +5679
+ Misses 8127 5365 -2762
- Partials 0 128 +128
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
superset-frontend/spec/javascripts/messageToasts/components/Toast_spec.jsx
Outdated
Show resolved
Hide resolved
f8cb19d
to
8746a36
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking AWESOME. Only a couple of minor questions, hoping to steer things a little more toward consistency (i.e. fewer style overrides) if it makes sense. If the ones I asked about need to be that way, then so be it, I'll approve and merge!
@rusackas Those were great observations. For me these specific properties (margins) are related to positioning of the component in a screen so they are not generic but layout based. With that in mind, Alert already have properties for this scenario:
This makes more clear the we are positioning the element and have the benefit of autocompletion and type checking. You were totally wright about the mismatching grid units. I changed all to 4. Let me know if you agree with that 😉 |
0f6896d
to
654defb
Compare
If these are one-off, situational tweaks, then I prefer the way you have it here, using the |
I think if we add @lilykuang 's suggested tweak (nice catch!) this PR will be good to go! |
654defb
to
4ff366a
Compare
@rusackas Accepted @lilykuang suggestion. I did a forced push to preserve commit history. I wish they implemented --amend in suggested changes. |
Need some design input, but have we considered using different colors by status for toasts as well? Icons are great, but still not very differentiable. |
@ktmud We have considered but chose to keep the same style until we migrate Toast to AntD Notification in a specific PR. This is how it looks like in AntD: |
Great. Good to hear! |
e4a9e36
to
8c8b05b
Compare
4a0e857
to
7b708ec
Compare
7b708ec
to
a8cdc91
Compare
b74bb2b
to
878c5a1
Compare
Added new tests using React Testing Library! |
878c5a1
to
b53b6fb
Compare
b53b6fb
to
3e67ceb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Merged with master
border: 0, | ||
backgroundColor: baseColor.light2, | ||
'& .ant-alert-icon': { | ||
marginRight: 10, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 * gridUnit?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here I'm following the exact design specification values. If we want to change this maybe we should talk with the design team to use multiples of 4 when dealing with margins, padding, etc.
icon={<Icon name={iconName} aria-label={`${type} icon`} />} | ||
closeText={closable && <Icon name="x-small" aria-label="close icon" />} | ||
css={{ | ||
padding: '6px 10px', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if it makes sense to round these up or down to the nearest gridUnit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as the previous comment.
'We recommend your summarize your data further before following that flow. ', | ||
) + | ||
t('If activated you can use the ')} | ||
<strong>CREATE TABLE AS </strong> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<strong>CREATE TABLE AS </strong> | |
<strong>{t("Create table as").toUpperCase()} </strong> |
I'm guessing this would work? ¯\_(ツ)_/¯
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this should be translated because it's referencing a command that doesn't have a translation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Noted a few minor nits, but again this PR looks great to me in general, so I'll stamp it, and circle back soon to merge whether or not those nits lead to any changes ;)
SUMMARY
Migrates Alert component from Bootstrap to AntD and creates a storybook with full controls support.
BEFORE/AFTER SCREENSHOTS
New Storybook!
Toast
had a dependency onAlert
. I removed this dependency by emulating the same behavior with a styleddiv
. I also added an icon for every status.We should consider replacing
Toast
code with AntD Notification.@rusackas @junlincc @mihir174
Closes #12101
See: #10254
ADDITIONAL INFORMATION