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

Icon house keeping updates #16621

Merged
merged 1 commit into from
Nov 23, 2022
Merged

Conversation

georgewrmarshall
Copy link
Contributor

Explanation

  • What is the current state of things and why does it need to change?
    Some small updates to the Icon component were required to match the quality and standard of our other components

  • What is the solution your changes offer and how does it work?
    This PR includes all of the house keeping updates that are listed in the issue as well as some other DX improvements

  • Fixes 🧹 [UI House Keeping] Icon #16186

Screenshots/Screencaps

Before

icon.before.mov

After

icon.after.mov

Manual Testing Steps

  • Go to the latest build of storybook in this PR
  • Search Icon in the search bar (make sure it's the one in component-library)
  • Check stories and documentation
  • Go through house keeping checklist

Pre-merge author checklist

  • I've clearly explained:
    • What problem this PR is solving
    • How this problem was solved
    • How reviewers can test my changes
  • Sufficient automated test coverage has been added

Pre-merge reviewer checklist

  • Manual testing (e.g. pull and build branch, run in browser, test code being changed)
  • PR is linked to the appropriate GitHub issue
  • IF this PR fixes a bug in the release milestone, add this PR to the release milestone

If further QA is required (e.g. new feature, complex testing steps, large refactor), add the Extension QA Board label.

In this case, a QA Engineer approval will be be required.

House keeping checklist

Also checked off in issue #16186

  • Ensure that the url for icon is being rendered correctly in the html
  • Has a className prop and the PropType descriptions are all the same
  • Prop table in MDX docs have the "Accepts all Box component props" description and link
  • We are consistent when using the same prop names like size and are suggesting the use of the generalized design-system.js constants e.g. SIZES as the primary option but noting the component consts in the documentation and using them for propType validation and storybook controls only
  • Standardize all similar prop names for images imgSrc, imgAlt(html element + attribute) (needs audit)
  • We have a story for each component prop and we use the prop name verbatim e.g. size prop would be export const Size = (args) => (
  • We have the accompanying documentation for each component prop and we use the prop name verbatim e.g. size prop would be ### Size
  • Are multiple props stories allowed? e.g. Color, Background Color And Border Color story in base-avatar - [ ] yes when it makes sense to
  • All Base components follow the suffix convention e.g. ButtonBase
  • All Base component MDX documentation have the base component notification at the top
  • Add mm- prefix to all classNames
  • className is kebab case version of the component name
  • Spread base components props and reduce duplication of props when props aren't being changed and remain the same for both variant and base components
  • Add component to root index.js file in component-library
  • Add locals for any default text I18nContext as default context
  • Add any "to dos" with a // TODO: comment so we can search for them at a later date e.g. blocking components etc
  • Add snapshot testing
  • Add pixel values to propType descriptions if we use abstracted prop types that relate to pixel values e.g. SIZE.MD (32px)
  • Each prop section in the MDX docs should have: a heading, a description, a story and an example code snipped

@georgewrmarshall georgewrmarshall added area-UI Relating to the user interface. team-design-system All issues relating to design system in Extension IA/NAV labels Nov 22, 2022
@georgewrmarshall georgewrmarshall self-assigned this Nov 22, 2022
@github-actions
Copy link
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

Comment on lines +6 to +12
* Search for an icon: https://metamask.github.io/metamask-storybook/?path=/story/ui-components-component-library-icon-icon-stories-js--default-story
*
* Add an icon: https://metamask.github.io/metamask-storybook/?path=/docs/ui-components-component-library-icon-icon-stories-js--default-story#adding-a-new-icon
*
* ICON_NAMES is generated using svgs in app/images/icons and
* the generateIconNames script in development/generate-icon-names.js
* then stored as an environment variable
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updating description here in hopes of directing engineers to the search icon page in storybook

LG: SIZES.LG,
XL: SIZES.XL,
AUTO: SIZES.AUTO,
};
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Adding ICON_SIZES to curate sizes passed to storybook controls and propTypes

* Possible values could be 'SIZES.XXS', 'SIZES.XS', 'SIZES.SM', 'SIZES.MD', 'SIZES.LG', 'SIZES.XL',
* Default value is 'SIZES.MD'.
* Possible values could be SIZES.XXS (10px), SIZES.XS (12px), SIZES.SM (16px), SIZES.MD (20px), SIZES.LG (24px), SIZES.XL (32px),
* Default value is SIZES.MD (20px).
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Adding pixel values for sizes in propType comments

@@ -107,7 +108,7 @@ export const TextFieldBase = ({
backgroundColor={COLORS.BACKGROUND_DEFAULT}
alignItems={ALIGN_ITEMS.CENTER}
borderWidth={1}
borderRadius={SIZES.SM}
borderRadius={BORDER_RADIUS.SM}
paddingLeft={leftAccessory ? 4 : 0}
paddingRight={rightAccessory ? 4 : 0}
onClick={handleClick}
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 could move these into the text-field-base updates into the house keeping pr for text-field-base if it's cleaner I'll work on that next.

@@ -40,6 +40,7 @@
&__input {
border: none;
height: 100%;
width: 100%;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This fixes an issue I ran into using the read only input in the icon search page. I've checked other component libraries and it seems they do the same https://chakra-ui.com/docs/components/input/usage

Screen Shot 2022-11-21 at 10 54 18 PM

@georgewrmarshall georgewrmarshall marked this pull request as ready for review November 22, 2022 06:55
@georgewrmarshall georgewrmarshall requested a review from a team as a code owner November 22, 2022 06:55
@georgewrmarshall georgewrmarshall requested review from PeterYinusa, garrettbear and NidhiKJha and removed request for PeterYinusa November 22, 2022 06:55
@metamaskbot
Copy link
Collaborator

Builds ready [06b1b37]
Page Load Metrics (2330 ± 96 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint983041345225
domContentLoaded19742762232219292
load19742762233020096
domInteractive19742762232219292
Bundle size diffs
  • background: 0 bytes
  • ui: 527 bytes
  • common: 0 bytes

highlights:

storybook

@georgewrmarshall georgewrmarshall merged commit ab808b6 into develop Nov 23, 2022
@georgewrmarshall georgewrmarshall deleted the fix/16186/icon-house-keeping branch November 23, 2022 17:58
@github-actions github-actions bot locked and limited conversation to collaborators Nov 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-UI Relating to the user interface. team-design-system All issues relating to design system in Extension
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🧹 [UI House Keeping] Icon
4 participants