reactjs / reactjs/react-docgen
styled-components and Glamorous support
Nessuno ha ancora preso questa issue.
- Lingua principale
- TypeScript
- Stelle
- 3.8k
- Fork
- 316
- Merge medio
- 5h 7m
- PR unite (30g)
- 4
Descrizione
Further to this discussion https://github.com/styleguidist/react-styleguidist/issues/37
If you are using styled-components, you may have a component similar to:
import styled, { css } from "styled-components";
import PropTypes from "prop-types";
const Button = styled.a`
background: transparent;
color: white;
${({primary}) =>
!!primary &&
css`
background: white;
color: palevioletred;
`};
`;
Button.propTypes = {
primary: PropTypes.bool
};
export default Button;
or, with Glamorous:
import glamorous from "glamorous";
import PropTypes from "prop-types";
const Button = glamorous.button({
background: "transparent",
color: "white"
},
({ primary }) => (!!primary && {
background: "white",
color: "palevioletred"
})
);
Button.propTypes = {
primary: PropTypes.bool
};
This doesn't import React, so afaik is why the react-docgen resolver does not pick it up as a valid component.
No suitable component definition found.
Is there an existing way to get this to work e.g. with a custom resolver? Or is a bugfix/new feature needed?
#195 looks like it resolves this, and is marked as closed as the feature in v3. I've installed react-docgen@3.0.0-beta11 but still get the issue with the above 2 examples.
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Riproduci l’errore segnalato “No suitable component definition found” con gli esempi styled-components e Glamorous, quindi esamina il react-docgen resolver e la modifica referenziata da #195. Il lavoro è completato quando entrambi gli esempi vengono riconosciuti come componenti validi senza l’errore segnalato.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- javascript, react, typescript
- Ambito
- documentation, tooling
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 42/100