-
Notifications
You must be signed in to change notification settings - Fork 152
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
Add Playroom integration #4576
Add Playroom integration #4576
Changes from all commits
b20c7a6
c8a223b
5b20127
1c8e83d
d8c72d0
07c0821
70a28b3
3b3d558
9935cac
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Out of curiosity, do you know if there is any possibility of customizing the Playroom UI a little bit? Adding an orbit header, palette, etc. Not critical of course. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have never tried, but I recall seeing someone asking about it. I did not read through because I was looking for an answer on something else, though 😅 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
const path = require("path"); | ||
const { defaultFoundation } = require("@kiwicom/orbit-design-tokens"); | ||
|
||
module.exports = { | ||
title: "Orbit Playroom", | ||
components: require.resolve("./playroomComponents.tsx"), | ||
outputPath: "./.playroom/playroom", | ||
frameComponent: "./playroom/FrameComponent.tsx", | ||
snippets: "./playroom/snippets/index.ts", | ||
scope: "./playroom/scope.ts", | ||
port: 9000, | ||
openBrowser: false, | ||
widths: Object.values(defaultFoundation.breakpoint), | ||
defaultVisibleWidths: [ | ||
defaultFoundation.breakpoint.mediumMobile, | ||
defaultFoundation.breakpoint.desktop, | ||
], | ||
baseUrl: "/playroom/", | ||
webpackConfig: () => ({ | ||
resolve: { | ||
extensions: [".js", ".jsx", ".ts", ".tsx", ".css"], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need .js* extensions? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe playroom is actually checking for the built files, inside |
||
modules: [ | ||
"node_modules", | ||
path.resolve(__dirname), | ||
path.resolve(__dirname, "src"), | ||
path.resolve(__dirname, "lib"), | ||
path.resolve(__dirname, "node_modules"), | ||
path.resolve(__dirname, "../.."), | ||
], | ||
alias: { | ||
"@kiwicom/orbit-components": path.resolve(__dirname), | ||
}, | ||
}, | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.css$/i, | ||
sideEffects: true, | ||
exclude: /node_modules/, | ||
use: [ | ||
require.resolve("style-loader"), | ||
require.resolve("css-loader"), | ||
{ | ||
loader: require.resolve("postcss-loader"), | ||
options: { | ||
postcssOptions: { | ||
plugins: [require.resolve("tailwindcss"), require.resolve("autoprefixer")], | ||
}, | ||
}, | ||
}, | ||
], | ||
}, | ||
{ | ||
test: /\.(js|jsx|ts|tsx)$/, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above |
||
exclude: /node_modules/, | ||
use: { | ||
loader: "babel-loader", | ||
options: { | ||
presets: ["@babel/preset-env", "@babel/preset-react", "@babel/preset-typescript"], | ||
}, | ||
}, | ||
}, | ||
], | ||
}, | ||
}), | ||
reactDocgenTypescriptConfig: { | ||
// TODO: Disabling prop intellisense until we can fix the issue with correctly getting the props | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Have we created a ticket about this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No. I will create tickets for playroom improvements now |
||
propFilter: () => false, | ||
}, | ||
exampleCode: ` | ||
<div className="bg-white-normal p-300 h-screen"> | ||
<Context> | ||
{() => { | ||
const [hasError, setHasError] = React.useState(false); | ||
|
||
return ( | ||
<Button | ||
onClick={() => setHasError(!hasError)} | ||
type={hasError ? "critical" : "primary"} | ||
> | ||
{hasError ? "Ups, click again" : "Click Me"} | ||
</Button> | ||
); | ||
}} | ||
</Context> | ||
</div> | ||
`, | ||
}; |
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.
Will we remove the playground logic? If so, will it be part of a different task?
In case we want to create a ticket.