azz / styled-css-grid

🍱 A tiny CSS grid layout for React
https://styled-css-grid.js.org/
MIT License
623 stars 42 forks source link

[BREAKING CHANGE] Support @emotion/styled #63

Open philippefutureboy opened 4 years ago

philippefutureboy commented 4 years ago

Hello!

I love your little library, and I'd love to be able to leverage it in my ecosystem with @emotion. My suggestion for the implementation would be to extract the styled component dependency from your library and offer an initialization hook of some sort that could take the styled library of choice as a parameter.

Something like this:

import styled from '@emotion/styled';
import { jsx, css } from '@emotion/core';
import { initialize } from 'styled-css-grid';

initialize({
  package: '@emotion/styled@^10',
  exports: {
    styled,
    jsx,
    css,
  }
});

And then in your code depending on the scope from the initialize function you could have a conditional that branches based on the API of the provided package.

How does that sound?

Have a great day!

Cheers,

Philippe