react-spectrum-charts icon indicating copy to clipboard operation
react-spectrum-charts copied to clipboard

feat: Add dimension prop to Combo

Open pratyushbanerjee opened this issue 1 year ago • 7 comments

Description

Adds dimension prop to Combo which is passed on to Bar and Line

Before After
<Combo>
  <Bar
    dimension="datetime"
    metric="people"
    metricAxis="people" 
  />
  <Line 
    dimension="datetime"
    metric="adoptionRate" 
    metricAxis="adoption"
  />
</Combo>
<Combo dimension="datetime">
  <Bar 
    metric="people"
    metricAxis="people" 
  />
  <Line 
    metric="adoptionRate" 
    metricAxis="adoption"
  />
</Combo>

Related Issue

https://github.com/adobe/react-spectrum-charts/issues/364

Motivation and Context

Provides a simpler API to set the common dimension of the Combo chart

How Has This Been Tested?

  • Passed existing tests
  • Updated tests to cover changes

Screenshots (if appropriate):

Types of changes

  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [x] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • [x] I have signed the Adobe Open Source CLA.
  • [x] My code follows the code style of this project.
  • [x] My change requires a change to the documentation.
  • [x] I have updated the documentation accordingly.
  • [x] I have read the CONTRIBUTING document.
  • [x] I have added tests to cover my changes.
  • [x] All new and existing tests passed.

pratyushbanerjee avatar Aug 13 '24 09:08 pratyushbanerjee

🎨 Storybook -> https://opensource.adobe.com/react-spectrum-charts/PR-393

github-actions[bot] avatar Aug 13 '24 09:08 github-actions[bot]

Can we skip coverage requirement for pseudo component?

pratyushbanerjee avatar Aug 13 '24 09:08 pratyushbanerjee

You could do something like we have in Bar.test.tsx. You will see that the first test just renders the pseudo component. That is enough to count it as covered. If for some reason it isn't a react component, then that test would fail to render.

I would create a file called Combo.test.tsx in src/stories/components/Combo/ and add the test to that. Seems like a silly test but it does at least ensure that the component is a react component.

marshallpete avatar Aug 15 '24 17:08 marshallpete

🎨 Storybook -> https://opensource.adobe.com/react-spectrum-charts/PR-393

github-actions[bot] avatar Aug 16 '24 06:08 github-actions[bot]

🎨 Storybook -> https://opensource.adobe.com/react-spectrum-charts/PR-393

github-actions[bot] avatar Aug 16 '24 06:08 github-actions[bot]

Thanks! Added the tests

pratyushbanerjee avatar Aug 16 '24 06:08 pratyushbanerjee

🎨 Storybook -> https://opensource.adobe.com/react-spectrum-charts/PR-393

github-actions[bot] avatar Aug 21 '24 15:08 github-actions[bot]