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

Bugs around styled-components 4.0 beta #347

Closed
eramdam opened this issue Sep 20, 2018 · 8 comments
Closed

Bugs around styled-components 4.0 beta #347

eramdam opened this issue Sep 20, 2018 · 8 comments
Labels
bug Something isn't working

Comments

@eramdam
Copy link

eramdam commented Sep 20, 2018

Bug Report

Some features of styled-components 4.0.0 beta are broken when used inside a Docz document.
I would open a bug to SC directly but the same code works fine in react-styleguidist so I'm not quite sure where I should open the issue.

The bugs seems to be mainly around the styled() syntax of styled-components. Which I assume got changed a bit internally with 4.x.

Considering this file

https://github.com/eramdam/docz-repro-error/blob/master/test/hello.tsx

Here is how it's supposed to look (and how it looks under styled-components 3.x):

screen shot 2018-09-20 at 3 22 11 pm

Here is how it looks with styled-components 4.x installed:

screen shot 2018-09-20 at 3 20 45 pm

Feel free to clone https://github.com/eramdam/docz-repro-error and alternate between the master branch (4.x) and sc-v3 (3.x) to try.

I'd be happy to provide more details if needed.

@pedronauck pedronauck added the bug Something isn't working label Sep 20, 2018
@jamsch
Copy link

jamsch commented Sep 21, 2018

styled-components v4 somehow broke my app's navigation as well as extending on base styles didn't seem to work. No console errors or logs. I don't think it's related to docz though.

@guilhermedecampo
Copy link

For me docz is not reading propTypes from styled components.

Link.js

import { Link as L } from '@reach/router'
import styled from 'styled-components'
import PropTypes from 'prop-types'

const Link = styled(L)`
  font-weight: bold;
  line-height: 1.5;
`

Link.propTypes = {
  to: PropTypes.string.isRequired,
}

export default Link

Link.mdx

---
name: Link
---

import { Playground, PropsTable } from 'docz'
import Link from './Link'

# Link

<PropsTable of={Link} />

## Basic usage

<Playground>
  <Link to="/">This is a link</Link>
</Playground>

screen shot 2018-09-26 at 18 28 42

dev mode

@pedronauck
Copy link
Member

This problem is related to docgen parser, duplicated from #240 and all that depends of resolve this docgen bug 😕

@eramdam
Copy link
Author

eramdam commented Sep 27, 2018

@pedronauck even the rendering issue with styled-components?

@pedronauck pedronauck reopened this Sep 27, 2018
@pedronauck
Copy link
Member

Sorry @eramdam, the rendering issue isn't a bug from react-docgen, I'll keep this openning 🙏

@itshizhan
Copy link

itshizhan commented Dec 14, 2018

this is a real gotcha issue. i resolve it as follows:

// Link is a styled components
const LinkWrapper = (props)=>(
   <Link {...props}/>
)
// docz reading propTypes from LinkWrapper
LinkWrapper.propTypes = {
   //props
}
export default LinkWrapper

@antoniojps
Copy link

Any follow up on this issue?

@pedronauck
Copy link
Member

I'm closing this issue now in favor of the new one, most of the problems have been solved and are working now, but some others appeared.

@pedronauck pedronauck unpinned this issue Mar 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants