Skip to content

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

Description

@codepunkt

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

Activity

  1. javiercf commented on Oct 4, 2017

    @javiercf

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

  2. codepunkt commented on Oct 5, 2017

    @codepunkt
    OwnerAuthor

    @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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions