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

@reshadow/styled does not support of "referring to other components" #43

Open
comerc opened this issue Jun 16, 2019 · 2 comments
Open
Labels
enhancement New feature or request

Comments

@comerc
Copy link

comerc commented Jun 16, 2019

https://www.styled-components.com/docs/advanced#referring-to-other-components

const StyledComponent = styled(Component)`
  ${Wrapper} {
    position: relative;
    margin: 1px auto;
  }
  ${Highlights} {
    position: absolute;
    left: 0;
    top: 0;
  }
`

const Component = ({ className }) => (
  <div className={className}>
    <Wrapper>
      <Highlights/>
    </Wrapper>
  </div>
)

Invalid result:
Снимок экрана от 2019-06-16 15-57-53

@comerc
Copy link
Author

comerc commented Jun 16, 2019

Also I have problems with other HOCs (see above): ReactTimeout for example.

@lttb lttb added the enhancement New feature or request label Jun 18, 2019
@radist2s
Copy link

@comerc, checkout my babel plugin which allows to use variable identifiers as Reshadow selectors.

import {css} from 'reshadow' // any package is configurable
import literalShadow from '@radist2s/babel-plugin-literal-shadow'

const Button = () => <button />
const Text = () => <input />
const style = css`
    ${literalShadow(Button)} {
        color: red;
    }

    /** template literal inside template literal, what is the madness! **/
    /** does the same as function call in different syntax **/
    ${literalShadow`${Text}`} {
        color: red;
    }
`

@lttb, what do you thing about this approach?

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

No branches or pull requests

3 participants