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

change API so that it accepts both css strings and style objects #17

Open
codepunkt opened this issue Oct 4, 2017 · 2 comments
Open
Labels

Comments

@codepunkt
Copy link
Owner

codepunkt commented Oct 4, 2017

Change API so that it accepts both css strings and style objects

@javiercf
Copy link

javiercf commented Oct 4, 2017

with this do you refer to the ability to pass both margin-left and marginLeft as valid arguments in the object?

@codepunkt
Copy link
Owner Author

codepunkt commented Oct 5, 2017

@javiercf At the current state of the repository, i'm working on a major rewrite, which will lead to a new major version (v5) being published. The current documentation README.md is outdated and doesn't reflect what the current state of the code actually does.

At the moment, the API has 3 arguments startStyleString, endStyleString, options (optional):

spring(
  'border-bottom: 1px solid #f00;',
  'border-bottom: 25px solid #bada55;',
  { precision: 3 }
)

I would like an API that accepts 3 arguments startStyles, endStyles, options (optional), where start and endStyles can be one of strings (supported atm) or style objects like this:

spring(
  { borderBottom: '1px solid #f00' },
  { borderBottom: '25px solid #bada55' },
  { precision: 3 }
)

I assume that a package/module that converts one to the other exists in the css-in-js world (aphrodite, radium, styled-components, glamor, fela, glamorous, emotion, styletron etc) - i just don't know which one.

I would love to find out the best module suited for this task (small bytesize, does what we want), then check the parameter types on spring invocation and convert style objects to style strings if objects are give so that the business logic itself only has to deal with string styles.

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

2 participants