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

Trial Bar: Add component #2025

Merged
merged 20 commits into from
Jun 21, 2019
Merged

Conversation

pulkonet
Copy link
Contributor

@pulkonet pulkonet commented Jun 9, 2019

Fixes #2006

Also adds an inverse variant to the dropdown menu component, to work with Trial Bar.

Additional description


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/.
  • 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.

@pulkonet pulkonet marked this pull request as ready for review June 12, 2019 01:01
@garygong
Copy link
Contributor

Awesome! @davidlygagnon and I will take a look at this PR tomorrow!

@interactivellama interactivellama temporarily deployed to design-system-react-co-pr-2025 June 12, 2019 13:36 Inactive
*/
style: PropTypes.object,
};

Copy link
Contributor

Choose a reason for hiding this comment

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

@garygong @davidlygagnon I would recommend non-custom props for TrailBar's Button and Dropdown link to the Button and Dropdown doc pages in the comment on this line inside a comment which would be the larger type on the component description. This would allow the removal of the prop table from the docs and decrease duplicate lines of code which may not be updated in the future, for instance, when we add props to dropdown.

Something closer to Radio on this page https://react.lightningdesignsystem.com/components/radio-groups/

Source: https://github.com/salesforce/design-system-react/blob/master/components/radio-group/index.jsx#L4

@interactivellama interactivellama changed the title Trial Bar: Adds trial bar component from SLDS Trial Bar: Add component Jun 12, 2019
@interactivellama interactivellama temporarily deployed to design-system-react-co-pr-2025 June 13, 2019 02:58 Inactive
Copy link
Contributor

@davidlygagnon davidlygagnon 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 Pulkit! Just left a few comments. Thanks

components/trial-bar/index.jsx Outdated Show resolved Hide resolved
components/trial-bar/index.jsx Show resolved Hide resolved
components/trial-bar/dropdown.jsx Show resolved Hide resolved
components/trial-bar/index.jsx Outdated Show resolved Hide resolved
const TrialBarDropdown = (props) => {
const { label, ...rest } = props;
return (
<Dropdown {...rest} inverse>
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it really necessary to add a new prop inverse on dropdown component since it's only adding a class name? Maybe we can just use className instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can use just the className but isn't having an inverse variant of the dropdown worth it?


// This component accepts the same props as Button.
// eslint-disable-next-line react/forbid-foreign-prop-types
const { propTypes } = Button;
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if we really need this and whether it will break people that are using the babel-plugin-transform-react-remove-prop-types plugin to remove props. Would it be sufficient to just have a link pointing to the Dropdown component?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I used BuilderHeader for reference, if that's working for the consumers I don't think this is much different. I will update it if need be.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok - let's leave as is then.

import Button from '~/components/button';
import { TRIAL_BAR_BUTTON } from '../../utilities/constants';

// This component accepts the same props as Button.
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a doc site matter, so it's not very obvious, but this comment should follow the way that component descriptions should to be written to be picked up by react-docgen. I think that requires the comment it to in multi-line quote comment on the line directly before the class/function declaration. A markdown URL to the Button page would be good https://react.lightningdesignsystem.com/components/buttons/ . I think there are other examples in the library. The easiest way to check is to run npm build:docs and make sure this component shows up.

@davidlygagnon I'd recommend running the doc site consuming this branch locally to make sure all the comments and props show up correctly--or maintainers can fix this up, since the doc site isn't public. Either way is fine. As you know, the whole library/doc site can be finicky. Kevin and I spent some time with Setup Assistant yesterday.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have added multi-line comments right before the components declaration but haven't removed the propTypes. It is as done in BuilderHeader component that I was using as a reference. Let me know if this needs further updation.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm referring to doc comments only. Please see https://github.com/salesforce/design-system-react/blob/master/components/builder-header/nav-dropdown.jsx#L16

which shows up on the doc site here:
Screen Shot 2019-06-13 at 1 57 59 PM

Please add a link to the doc site Button there.

Copy link
Contributor

Choose a reason for hiding this comment

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

Cool - I'll double check by building the doc site locally.

@interactivellama interactivellama temporarily deployed to design-system-react-co-pr-2025 June 13, 2019 18:25 Inactive
@interactivellama interactivellama temporarily deployed to design-system-react-co-pr-2025 June 13, 2019 18:28 Inactive
@interactivellama interactivellama temporarily deployed to design-system-react-co-pr-2025 June 14, 2019 17:03 Inactive
davidlygagnon
davidlygagnon previously approved these changes Jun 17, 2019
Copy link
Contributor

@davidlygagnon davidlygagnon 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 to me!

Will be merging today.

@davidlygagnon
Copy link
Contributor

davidlygagnon commented Jun 17, 2019

@pulkonet Before we merge this, we need to fix the docs:

  1. add trial-bar to site.stories.jsx.

Screen Shot 2019-06-17 at 11 41 20 AM

2. The docs are showing the wrong component.

Screen Shot 2019-06-17 at 11 45 46 AM

Please update components/trial-bar/__docs__/site-stories.js to use trial-bar instead of progress-bar.

@interactivellama interactivellama temporarily deployed to design-system-react-co-pr-2025 June 18, 2019 04:23 Inactive
@interactivellama interactivellama temporarily deployed to design-system-react-co-pr-2025 June 19, 2019 03:24 Inactive
@interactivellama interactivellama temporarily deployed to design-system-react-co-pr-2025 June 19, 2019 03:29 Inactive
@davidlygagnon
Copy link
Contributor

@pulkonet I'm still seeing a few console errors on launching the docs site. We need to expose the sub-components of trial-bar as well (TrialBarButton, TrialBarDropdown).

Screen Shot 2019-06-19 at 7 39 16 AM

We're almost there!

@interactivellama interactivellama temporarily deployed to design-system-react-co-pr-2025 June 19, 2019 17:25 Inactive
davidlygagnon
davidlygagnon previously approved these changes Jun 21, 2019
@davidlygagnon
Copy link
Contributor

@pulkonet I'm ready to merge it now. Doc site shows the component correctly. Can you fix the merge conflicts. Thanks!

@davidlygagnon davidlygagnon merged commit 7f96518 into salesforce:master Jun 21, 2019
@pulkonet pulkonet deleted the f/trial-bar branch June 21, 2019 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Trial Bar Component
4 participants