-
Notifications
You must be signed in to change notification settings - Fork 355
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
fix(examples and docs): adding react-live… #666
Conversation
… for the docs examples affects: patternfly4-react-lerna-root, @patternfly/react-core, @patternfly/react-docs
PatternFly documentation deployment: https://666-pr-patternfly-react-patternfly.surge.sh |
Pull Request Test Coverage Report for Build 2243
💛 - Coveralls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome PR!
const transformCode = code => { | ||
try { | ||
// LiveEditor doesn't work properly with these so need to remove | ||
code = code.replace(/^\s*import.*$/gm, ''); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you able to do this on gatsby node? It might speed up client-side rendering. Not a big deal if it is not possible though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good suggestion, I will try it out
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Had trouble getting the raw file contents in gatsby-node. Going to stick with this for now.
code = code.replace(/extends Component/gm, 'extends React.Component'); | ||
code = code.replace(/^\s*export.*$/gm, ''); | ||
code = code.replace(/^\s*static.*$/gm, ''); | ||
const transformedCode = transform(code, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Internally it looks like React-Live uses (buble)[https://buble.surge.sh/guide/#jsx] which supports jsx. I did not try this without babel so it might actually be needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I had more issues with buble so I switched to babel
@@ -32,12 +32,17 @@ const Layout = ({ children, data }) => { | |||
|
|||
return ( | |||
<React.Fragment> | |||
<Helmet | |||
{/* <Helmet |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can either be removed or readded. Might be nice to include the meta tags though. You should be able to keep the links that you added as children.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added them back in
@@ -2,8 +2,8 @@ import React from 'react'; | |||
import { Badge } from '@patternfly/react-core'; | |||
import getContainerProps from './common/getContainerProps'; | |||
|
|||
class UnreadBadge extends React.Component { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these changes were already made with pr #662 that was merged yesterday.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah ok good, I will merge with master and repush
Added env variables so it can also be disabled if needed. Btw #666 😈 |
… for the docs examples
affects: patternfly4-react-lerna-root, @patternfly/react-core, @patternfly/react-docs
What:
Added react-live to react-docs for live running examples