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

feat: Add support for inserting and previewing snippets #117

Merged
merged 5 commits into from Feb 4, 2020
Merged

Conversation

@michaeltaranto
Copy link
Contributor

michaeltaranto commented Jan 30, 2020

Adds support for providing snippets to playroom. This allows consumers to define patterns or larger compositions of components.

Opening the snippets panel formats the code and highlights the location that the snippet will be inserted. The snippets are previewed in-situ across themes and viewports as you navigate the list, supporting a faster exploration and prototyping workflow.

Snippets can be configured as follows:

// playroom.config.js

module.exports = {
  ...
  snippets: './snippets/index.js' // path to module exporting snippets
}
// snippets/index.js

export default [
  {
    group: string, // title of snippet, eg. `Button`
    name: string,  // additional detail, eg. `Strong` 
    code: string   // <Button weight="strong">Button</Button>
  },
  ...
];

Closes #38

assertFirstFrameContains('Foo');
assertCodePaneContains('<Foo><Foo><Bar/></Foo></Foo>');
it('frames are interactive', () => {
getFirstFrame().click('center');

This comment has been minimized.

Copy link
@mattsjones

mattsjones Jan 30, 2020

Contributor

Isn't this function is async? Also this test has no assertions. Is that intentional?

This comment has been minimized.

Copy link
@michaeltaranto

michaeltaranto Jan 30, 2020

Author Contributor

Just moved the test in the PR. The very act of clicking on the frame is the test. If something is blocking the frame this test fails.

@michaeltaranto michaeltaranto force-pushed the snippets branch from 1d593eb to e69341c Feb 3, 2020
@michaeltaranto michaeltaranto force-pushed the snippets branch from e69341c to 98a9ea9 Feb 3, 2020
README.md Outdated Show resolved Hide resolved
Copy link
Member

markdalgleish left a comment

🎉🎉

Co-Authored-By: Mark Dalgleish <mark.john.dalgleish@gmail.com>
@michaeltaranto michaeltaranto merged commit 1477830 into master Feb 4, 2020
2 checks passed
2 checks passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
@michaeltaranto michaeltaranto deleted the snippets branch Feb 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked issues

Successfully merging this pull request may close these issues.

3 participants
You can’t perform that action at this time.