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

style: new toast design closer to SIP-34 #10178

Merged
merged 13 commits into from Jul 10, 2020

Conversation

lilykuang
Copy link
Member

@lilykuang lilykuang commented Jun 26, 2020

SUMMARY

This PR is still work in process but I'd like to have early feedback.

  • update Toast style to match SIP-34
  • change Toast and ToastPresenter to typescript
  • move toast.less to emotion style
  • add Icon and style for error/warning and success toast

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Before
before_toast
After
Success Toast
after_toast
Error/Warning Toast
Screen Shot 2020-07-06 at 5 59 53 PM

TEST PLAN

  • toggle ENABLE_REACT_CRUD_VIEWS config flag, see changes in dataset/chart view

ADDITIONAL INFORMATION

  • Has associated issue:
  • Changes UI
  • Requires DB Migration.
  • Confirm DB Migration upgrade and downgrade tested.
  • Introduces new feature or API
  • Removes existing feature or API

@lilykuang lilykuang marked this pull request as draft June 26, 2020 21:59
@@ -145,8 +145,11 @@ function SelectFilter({
data-test="filters-select"
themeConfig={filterSelectTheme}
stylesConfig={filterSelectStyles}
// @ts-ignore
Copy link
Member

Choose a reason for hiding this comment

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

It seems I introduced these issues when I added https://github.com/vtaits/react-select-async-paginate in #10035 and this PR merely uncovered them (for some reason... 🤔). I'll address in another PR if it's possible, the types for that package are quite confusing.

@codecov-commenter
Copy link

codecov-commenter commented Jun 26, 2020

Codecov Report

Merging #10178 into master will decrease coverage by 0.46%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #10178      +/-   ##
==========================================
- Coverage   70.15%   69.68%   -0.47%     
==========================================
  Files         598      194     -404     
  Lines       32004    18862   -13142     
  Branches     3236        0    -3236     
==========================================
- Hits        22451    13144    -9307     
+ Misses       9448     5718    -3730     
+ Partials      105        0     -105     
Flag Coverage Δ
#cypress ?
#javascript ?
#python 69.68% <ø> (+0.06%) ⬆️
Impacted Files Coverage Δ
.../src/dashboard/util/getFilterScopeFromNodesTree.js
...ontend/src/explore/components/QueryAndSaveBtns.jsx
...hboard/components/menu/BackgroundStyleDropdown.jsx
...nd/src/dashboard/components/ColorComponentPane.jsx
superset-frontend/src/SqlLab/constants.js
superset-frontend/src/components/Loading.tsx
...dashboard/components/FilterIndicatorsContainer.jsx
...et-frontend/src/dashboard/components/Dashboard.jsx
...shboard/components/filterscope/FilterFieldItem.jsx
...src/dashboard/components/HeaderActionsDropdown.jsx
... and 394 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8d9bb5f...62da4ba. Read the comment docs.

@lilykuang lilykuang marked this pull request as ready for review June 29, 2020 19:17
@lilykuang lilykuang changed the title style: new toast design closer to SIP-34 style: [WIP] new toast design closer to SIP-34 Jun 29, 2020
Copy link
Member

@etr2460 etr2460 left a comment

Choose a reason for hiding this comment

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

i'm a little concerned with how large the package-lock diff is here, i wouldn't expect the dep changes to cause such a large change. Can you validate to make sure this is correct?

@@ -61,14 +61,14 @@
"@emotion/core": "^10.0.28",
"@superset-ui/chart": "^0.14.1",
"@superset-ui/chart-composition": "^0.14.1",
"@superset-ui/color": "^0.14.2",
"@superset-ui/chart-controls": "^0.14.1",
"@superset-ui/color": "^0.14.1",
Copy link
Member

Choose a reason for hiding this comment

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

were the downgrades here intentional?

Copy link
Member Author

Choose a reason for hiding this comment

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

@etr2460 I didn't clean up conflict correctly. All package should be up to date now.


interface ToastPresenterProps {
toast: { id: string; toastType: ToastType; text: string; duration: number };
onCloseToast: (arg0: string) => void;
Copy link
Member

Choose a reason for hiding this comment

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

let's name this argument


const ToastPresenter = ({ toasts, removeToast }: ToastPresenterProps) =>
toasts.length > 0 && (
<StyledToastPresenter id="toast-presenter">
Copy link
Member

Choose a reason for hiding this comment

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

Do you think using a Portal for this might make it easier?

Copy link
Member

Choose a reason for hiding this comment

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

Although looking at the diff, it seems like this was written like this before, so up to you if you want to see if a Portal is easier or not

Copy link
Member Author

Choose a reason for hiding this comment

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

I think I will keep this way

@lilykuang lilykuang requested review from etr2460 and nytai July 7, 2020 01:09
@lilykuang lilykuang changed the title style: [WIP] new toast design closer to SIP-34 style: new toast design closer to SIP-34 Jul 7, 2020
Copy link
Member

@etr2460 etr2460 left a comment

Choose a reason for hiding this comment

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

thanks for fixing the package lock conflict, a couple more comments

@@ -97,13 +117,17 @@ class Toast extends React.Component {
toastType === DANGER_TOAST && 'toast--danger',
Copy link
Member

Choose a reason for hiding this comment

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

Are these classes still needed? It looks like they're unused now

Comment on lines 121 to 125
{toastType === SUCCESS_TOAST ? (
<Icon name="check" />
) : (
<Icon name="error" />
)}
Copy link
Member

Choose a reason for hiding this comment

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

Since we have a warning icon, should we use that for the WARNING_TOASTs too? And perhaps add an info icon as well? If we don't add the info icon, should we perhaps default to no icon at all, since it could be confusing for an info toast to show an error icon

Copy link
Member Author

Choose a reason for hiding this comment

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

I will prefer info toasts without Icon and warning toasts will have the same icon as error.

}
`;

type ToastType =
Copy link
Member

Choose a reason for hiding this comment

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

this is defined twice, let's pull it into a types.ts file

@etr2460
Copy link
Member

etr2460 commented Jul 7, 2020

one more design nit, not sure if it's worth fixing though... It seems like the x isn't vertically centered in the toast. It's easier to see when enlarged:
image

under the License.
-->
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22C17.5228 22 22 17.5228 22 12C22 9.34784 20.9464 6.8043 19.0711 4.92893C17.1957 3.05357 14.6522 2 12 2Z" fill="#666666"/>
Copy link
Member

Choose a reason for hiding this comment

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

One more comment, I think you might need to default the fill attribute to "currentColor" so that we can override the color of the icon with CSS

Copy link
Member

Choose a reason for hiding this comment

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

CSS rules end up overriding the property. However, it's best to be consistent and use currentColor.

Copy link
Member

@etr2460 etr2460 Jul 9, 2020

Choose a reason for hiding this comment

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

ah, I see. I was using color to change the icon's color and not fill so it didn't work. Do we prefer to override this with color or fill on the icon? i was planning a change to the Icon component to get rid of styled and use this method instead; with this then color works:

const Icon = ({ name, color = '#666666', ...rest }: IconProps) => {
  const Component = iconsRegistry[name];
  return <Component color={color} {...rest} />;
};

export default Icon;

Copy link
Member

Choose a reason for hiding this comment

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

color seems reasonable, as that's how the icon fonts behave. We should def try to use currentColor for fill rules when it makes sense as it allows for the most flexibility.

@lilykuang lilykuang requested a review from etr2460 July 10, 2020 21:25
@lilykuang lilykuang closed this Jul 10, 2020
@lilykuang lilykuang reopened this Jul 10, 2020
Copy link
Member

@nytai nytai left a comment

Choose a reason for hiding this comment

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

lgtm

Copy link
Member

@etr2460 etr2460 left a comment

Choose a reason for hiding this comment

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

lgtm too. thanks for the iterations!

@nytai nytai merged commit 3b4df51 into apache:master Jul 10, 2020
@nytai nytai deleted the lily/dataset-toast branch July 10, 2020 21:59
auxten pushed a commit to auxten/incubator-superset that referenced this pull request Nov 20, 2020
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.37.0 labels Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels size/XL 🚢 0.37.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants