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

Disable location styling. #16

Closed
dimitrisfasoulas opened this issue Jun 21, 2018 · 2 comments
Closed

Disable location styling. #16

dimitrisfasoulas opened this issue Jun 21, 2018 · 2 comments

Comments

@dimitrisfasoulas
Copy link
Contributor

dimitrisfasoulas commented Jun 21, 2018

I would like to style the component through CSS classes that I use in my app, but the location prop is enforcing some style.

I can disable this by passing a bogus string on location but then I will get an error in console:

Warning: Failed prop type: Invalid prop location of value none supplied to CookieConsent, expected one of ["top","bottom"].

It would be nice if we could provide null to location to remove said styling or if disableStyles would also disable said styles, or if we had another prop, for example disablePositioningStyles.

If you find one of the above solutions acceptable I could work on a pull request for it.

@Mastermindzh
Copy link
Owner

Seems like a solid plan!

I can implement it for you later today or you can make a pull-request, either will be fine.

I feel that location and style are different things, so supplying "none" to the location would offer the most flexible solution in my opinion.

You'd have to change

export const OPTIONS = {
  TOP: "top",
  BOTTOM: "bottom"
};

into

export const OPTIONS = {
  TOP: "top",
  BOTTOM: "bottom",
  NONE: ""
};

And we should update the proptype declaration too so that it will work with future values. Something like:

  location: PropTypes.oneOf(Object.values(OPTIONS)),

Doing it like this would just ignore the switch and not add position styling whilst keeping it backwards compatible (e.g if we'd change disablestyles and people update it would affect their bar position).

Good idea man! Let's make this work!

Mastermindzh pushed a commit that referenced this issue Jun 21, 2018
#17)

Fixes #16 

Allows location property to receive string `none` which will disable automatic placement of the component.
@Mastermindzh
Copy link
Owner

It's in 1.4 :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants