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

Change how are props render in methods using custom *Renderer component #40

Closed
struers-mfr opened this issue Nov 1, 2017 · 1 comment

Comments

@struers-mfr
Copy link

Hello guys,
I'm struggling with custom React *Renderer overwriting default components. I want render each argument prop from method on separate line and description in description column.

I was trying to start from this hint in cookbook section that define different layout How to change the layout of a style guide? but stuck on the compiler error. This error seems like there is no support of jsx compilation of React component, I try copy all dependencies from React-styleguidist but with no luck, always get this same error

Failed to compile.
./styleguide/StyleGuideRenderer.js
Syntax error: Unexpected token (9:2)

   7 |   hasSidebar,
   8 | }) => (
>  9 |   <div className="root">
     |   ^
  10 |     <h1>{title}</h1>
  11 |     <main className="wrapper">
  12 |       <div className="content">

What I am doing wrong?

@rafaesc
Copy link
Member

rafaesc commented Nov 1, 2017

Hello @struers-mfr,

you have to add the babel loader on the webpack config to support jsx, here
https://github.com/vue-styleguidist/vue-styleguidist/blob/master/docs/Webpack.md#custom-webpack-config

{
  test: /\.js?$/,
  exclude: /node_modules/,
  loader: 'babel-loader'
}

And add .babelrc in your project

{
  "presets": [
    "env",
    "react"
  ],
  "plugins": [
    "transform-class-properties"
  ]
}

@rafaesc rafaesc closed this as completed Nov 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants