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 Scoped Notification Component #1785

Merged
merged 17 commits into from May 3, 2019

Conversation

aswinshenoy
Copy link
Collaborator

@aswinshenoy aswinshenoy commented Mar 4, 2019

Fixes #1738
Add Scoped Notification Component

@interactivellama @futuremint, kindly review it, I will make any changes required.

Additional description

The Scoped Navigation component as found in SLDS has been ported to react, with almost all its functionality, and reusing the same classes.

Props Taken

  • className - CSS classes to be added to tag with .slds-scoped-notification.
  • iconName - Icon for the Scoped Notification
  • theme - Either Dark or Light

Screenshots

Light Variant
image
Dark Variant
image


CONTRIBUTOR checklist (do not remove)

Please complete for every pull request

  • First-time contributors should sign the Contributor License Agreement. It's a fancy way of saying that you are giving away your contribution to this project. If you haven't before, wait a few minutes and a bot will comment on this pull request with instructions.
  • npm run lint:fix has been run and linting passes.
  • Mocha, Jest (Storyshots), and components/component-docs.json CI tests pass (npm test).
  • Tests have been added for new props to prevent regressions in the future. See readme.
  • Review the appropriate Storybook stories. Open http://localhost:9001/.
  • The Accessibility panel of each Storybook story has 0 violations (aXe). Open http://localhost:9001/.
  • Review tests are passing in the browser. Open http://localhost:8001/.
  • Review markup conforms to SLDS by looking at DOM snapshot strings.

REVIEWER checklist (do not remove)

  • TravisCI tests pass. This includes linting, Mocha, Jest, Storyshots, and components/component-docs.json tests.
  • Tests have been added for new props to prevent regressions in the future. See readme.
  • Review the appropriate Storybook stories. Open http://localhost:9001/.
  • The Accessibility panel of each Storybook story has 0 violations (aXe). Open http://localhost:9001/.
  • Review tests are passing in the browser. Open http://localhost:8001/.
  • Review markup conforms to SLDS by looking at DOM snapshot strings.
Required only if there are markup / UX changes
  • Add year-first date and commit SHA to last-slds-markup-review in package.json and push.
  • Request a review of the deployed Heroku app by the Salesforce UX Accessibility Team.
  • Add year-first review date, and commit SHA, last-accessibility-review, to package.json and push.
  • While the contributor's branch is checked out, run npm run local-update within locally cloned site repo to confirm the site will function correctly at the next release.

@interactivellama
Copy link
Contributor

Props approved.

  • icon is not needed, but you can add an override if you'd like to. As far as I am aware of, the UX pattern is to always have an info icon.
  • Probably just a typo, but className should be on slds-scoped-notification.

@aswinshenoy
Copy link
Collaborator Author

@interactivellama I have made the necessary changes making the Icon prop optional, and setting info icon as default.

Copy link
Contributor

@interactivellama interactivellama left a comment

Choose a reason for hiding this comment

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

This good is almost done. There are a few small changes to make and I should be able to merge.

`slds-scoped-notification`,
`slds-media`,
`slds-media_center`,
`slds-scoped-notification_${this.props.theme}`,
Copy link
Contributor

Choose a reason for hiding this comment

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

CSS class names should not be concatenated. Please list out object keys with boolean values https://github.com/salesforce/design-system-react/blob/master/docs/codebase-overview.md#use-classnames-for-conditional-css-classes

render() {
return (
<div
style={{
Copy link
Contributor

Choose a reason for hiding this comment

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

Please remove extra styling.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I have removed extra styling from both light and dark examples

// Implements the [Scoped Notification design pattern](https://lightningdesignsystem.com/components/scoped-notifications/) in React.
// Based on SLDS v2.4.5
import IconSettings from '~/components/icon-settings';
import Icon from '~/components/icon';
Copy link
Contributor

Choose a reason for hiding this comment

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

The ~ import prefix should only be used in examples and not in components. I'm not sure what is documented anyway though. It's in the examples because a regular expression transform is run on them in the doc website.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I have replaced those with

import IconSettings from '../icon-settings';
import Icon from '../icon';

/**
* Icon for the scoped notification
*/
icon: PropTypes.string,
Copy link
Contributor

Choose a reason for hiding this comment

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

Icon would the an <Icon> component. This should probably be iconName and folks should know that it's limited to the utility set of icons at this point. https://www.lightningdesignsystem.com/icons/#utility

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ya, True. I went for a rather generic name, thanks for patching it up. I will take a note of it, and would update for the other prop proposals I have made elsewhere as well.

@interactivellama
Copy link
Contributor

This pull request does not have any tests. Since the component is not interactive Jest snapshots would be enough.

…to pr/aswinshenoy/1785

# Conflicts:
#	utilities/constants.js
role="status"
>
<div className="slds-media__figure">
<IconSettings iconPath="/assets/icons">
Copy link
Contributor

Choose a reason for hiding this comment

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

This line would limit all uses of the component to use this path. This should be removed. IconSettings should only be used outside a component by the consumer to allow customization.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oh true. I didn't think about it, thank you for fixing it :)

>
<div className="slds-media__figure">
<IconSettings iconPath="/assets/icons">
<Icon
Copy link
Contributor

Choose a reason for hiding this comment

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

This icon isn't using slds-icon-text-default classname which would make it darker. It's light here in Storybook, but dark on the SLDS website https://www.lightningdesignsystem.com/components/scoped-notifications/

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sorry again, I missed out that. Thank you for fixing it, and in the case in future, if you are engaged, I would be more than happy to patch these reviews comments :)

update icon to iconName since it is not an Icon component
…ystem-react into pr/aswinshenoy/1785

# Conflicts:
#	components/scoped-notification/__examples__/dark.jsx
#	components/scoped-notification/__examples__/light.jsx
#	components/scoped-notification/index.jsx
@interactivellama interactivellama added this to In progress in 2019-04 (April) via automation Apr 26, 2019
Copy link
Collaborator Author

@aswinshenoy aswinshenoy left a comment

Choose a reason for hiding this comment

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

I was about to send in the same lint patch, but I find it still not passing npm run lint.
It says something wrong with prettier, I tried npm run lint:fix, but the only thing that changed was the same as diff in your patch.
Is that okay?
image

@interactivellama
Copy link
Contributor

Those CI output lines look correct. What issues are you seeing?

@aswinshenoy
Copy link
Collaborator Author

aswinshenoy commented Apr 26, 2019

Those CI output lines look correct. What issues are you seeing?

It seems I misunderstood this, I thought the Travis was failing whenever these messages came. Sorry about those, hehe.
image

On a closer look, the exit return code says it all :) I shouldn't have bothered 👍 Stupid me.

@aswinshenoy aswinshenoy mentioned this pull request Apr 26, 2019
18 tasks
@interactivellama interactivellama self-assigned this May 2, 2019
@interactivellama interactivellama merged commit 958ace3 into salesforce:master May 3, 2019
Clear out PRs on roadmap automation moved this from In progress to Done May 3, 2019
2019-04 (April) automation moved this from In progress to Done May 3, 2019
@interactivellama interactivellama added this to Reviewer approved in GSoC2019 Evaluation-1 May 27, 2019
@interactivellama interactivellama moved this from Reviewer approved to Done in GSoC2019 Evaluation-1 May 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

Add Scoped Notifications
2 participants