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

Importing withResponsiveness() helper #144

Closed
dupski opened this issue Dec 4, 2018 · 7 comments
Closed

Importing withResponsiveness() helper #144

dupski opened this issue Dec 4, 2018 · 7 comments
Labels

Comments

@dupski
Copy link

dupski commented Dec 4, 2018

Hi Guys. Could you advise on the intended way to import the withResponsiveness helper?

Current Behaviour

In the docs it uses a relative import, which I assume is because you compile your docs examples (nice)

screen shot 2018-12-05 at 7 37 41 am

I've found the compiled version in britecharts-react/lib/esm/helpers and the below code works fine, but is quite long-winded:

import withResponsiveness from 'britecharts-react/lib/esm/helpers/withResponsiveness';

Expected Behaviour

I would like to import withResponsiveness() from the root, so:

import { Bar, withResponsiveness } from 'britecharts-react';

Possible Solution

Happy to submit a PR to fix this, just let me know :)

Your Environment

  • Version used: 0.4.1 with TypeScript 3.1 and React 16.6
@Golodhros
Copy link
Collaborator

Hi @dupski, thanks for opening this issue!

Well, we weren't planning to include that with the library, that's why is so hard to access. That said, this is not the first time that somebody asks for it.

Should we include it in our dist folder then?

@davegomez
Copy link
Contributor

Since is an option we have for the charts and is a feature listed in the docs I think it should be included or at least well referenced in the docs, but first I think we should fix the issue #105 that is still happening in britecharts-react v0.5.0 as you can confirm in this test project.

miglesiasEB pushed a commit that referenced this issue Dec 6, 2018
<!--- Provide a general summary of your changes in the Title above -->

## Description
<!--- Describe your changes in detail -->
The resizeMainHorizontal was added in the PR #84 as a hacking fix for the responsive container in the project documentation. This function broke the charts responsiveness outside the docs because it was looking for a `main` tag present in the **React Styleguidist** docs but not in every other project.

This PR removes the problematic function and uses the correct one to fix the problem.

The doc's responsiveness was tested using the original function and it work ok with this version of React Styleguidist.

This PR also address the issue #144 to make it easier to import the ResponsiveContainer component and the withResponsiveness helper.

## Motivation and Context
<!--- Why is this change required? What problem does it solve? -->
<!--- If it fixes an open issue, please link to the issue here. -->
* The charts' responsiveness is currently broken as described in the issue #105.
* At the moment is difficult to import the ResponsiveContainer component and the withResponsiveness helper because you have to do it directly from the ESM bundle.

## How Has This Been Tested?
<!--- Please describe in detail how you tested your changes. -->
<!--- Include details of your testing environment, and the tests you ran to -->
<!--- see how your change affects other areas of the code, etc. -->
* All the unit tests were ran and all of them passed.
* The documentation pages were reviewed to check for any inconsistency with the published one.

## Screenshots (if appropriate):

<img width="1676" alt="wide" src="https://user-images.githubusercontent.com/282903/49551467-5007dc80-f8bd-11e8-9611-53de3d8166c9.png">

<img width="1237" alt="narrow" src="https://user-images.githubusercontent.com/282903/49551475-58601780-f8bd-11e8-9fd6-eaf84ecaf96e.png">

## Types of changes
<!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->
- [ ] Refactor (changes the way we code something without changing its functionality)
- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)

## Checklist:
<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->
- [x] I have read the **CONTRIBUTING** document.
- [ ] I have updated the documentation accordingly.
- [ ] I have added tests to cover my changes.
- [x] All new and existing tests passed.
@miglesiasEB
Copy link
Collaborator

All ready and working properly!

@juanpaucar
Copy link

juanpaucar commented Dec 11, 2018

@miglesiasEB Hi guys, sorry to bother you. I was wondering if you have a date to upload this to npm. I'm having some issue with this on a typescript project and jest.... and I ran out of ideas to make it work for the tests :c

@Golodhros
Copy link
Collaborator

Hi @juanpaucar,

I just released 0.5.1 with this fix, it should be ready in NPM soon!

@juanpaucar
Copy link

Thank you very much :D

@dupski
Copy link
Author

dupski commented Dec 11, 2018

Awesome thanks guys :)

miglesiasEB pushed a commit that referenced this issue May 31, 2019
<!--- Provide a general summary of your changes in the Title above -->

## Description
<!--- Describe your changes in detail -->
The resizeMainHorizontal was added in the PR #84 as a hacking fix for the responsive container in the project documentation. This function broke the charts responsiveness outside the docs because it was looking for a `main` tag present in the **React Styleguidist** docs but not in every other project.

This PR removes the problematic function and uses the correct one to fix the problem.

The doc's responsiveness was tested using the original function and it work ok with this version of React Styleguidist.

This PR also address the issue #144 to make it easier to import the ResponsiveContainer component and the withResponsiveness helper.

## Motivation and Context
<!--- Why is this change required? What problem does it solve? -->
<!--- If it fixes an open issue, please link to the issue here. -->
* The charts' responsiveness is currently broken as described in the issue #105.
* At the moment is difficult to import the ResponsiveContainer component and the withResponsiveness helper because you have to do it directly from the ESM bundle.

## How Has This Been Tested?
<!--- Please describe in detail how you tested your changes. -->
<!--- Include details of your testing environment, and the tests you ran to -->
<!--- see how your change affects other areas of the code, etc. -->
* All the unit tests were ran and all of them passed.
* The documentation pages were reviewed to check for any inconsistency with the published one.

## Screenshots (if appropriate):

<img width="1676" alt="wide" src="https://user-images.githubusercontent.com/282903/49551467-5007dc80-f8bd-11e8-9611-53de3d8166c9.png">

<img width="1237" alt="narrow" src="https://user-images.githubusercontent.com/282903/49551475-58601780-f8bd-11e8-9fd6-eaf84ecaf96e.png">

## Types of changes
<!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->
- [ ] Refactor (changes the way we code something without changing its functionality)
- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)

## Checklist:
<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->
- [x] I have read the **CONTRIBUTING** document.
- [ ] I have updated the documentation accordingly.
- [ ] I have added tests to cover my changes.
- [x] All new and existing tests passed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants