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

Components: Add graphql support to SyntaxHighlighter #12385

Merged
merged 2 commits into from
Sep 10, 2020

Conversation

brendanrygus
Copy link

Background

I am currently working on an addon to display metadata about Apollo-connected components, building on the approach referenced in these docs: https://storybook.js.org/docs/react/workflows/build-pages-with-storybook#mocking-providers

This add-on leverages the SyntaxHighlighter Storybook component, but graphql highlighting is not exposed through the component library. As closely coupled Graphql integration becomes more common in React component development, it would be nice to treat this as a first-class language option.

(No issue, but I can file one if this requires further discussion)

What I did

  • Add graphql syntax highlighting to Storybook SyntaxHighlighter component
  • Add new Story example

How to test

SB-gql

Copy link
Member

@shilman shilman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any associated documentation that needs to be updated?

@brendanrygus
Copy link
Author

@shilman Thanks for checking in on this, I could have been more explicit in the PR description.
I searched around the codebase and didn't see any additional documentation around the SyntaxHighlighter component specifically - I assumed the Stories for the Storybook components were meant to be self-documenting.

The language prop for the component is loosely typed and will accept any string, so it will also not require a matching update:

export interface SyntaxHighlighterProps {
  language: string;
  copyable?: boolean;
  bordered?: boolean;
  padded?: boolean;
  format?: boolean;
  className?: string;
  renderer?: (props: SyntaxHighlighterRendererProps) => React.ReactNode;
}

If there are any examples in the repo that I missed, or there is output from the failing Docs (Storybook) — TeamCity build failed step to address, I'd be happy to make a fix.

@shilman shilman added this to the 6.1 docs milestone Sep 10, 2020
@shilman shilman changed the title [DS] Add graphql support to SyntaxHighlighter component Components: Add graphql support to SyntaxHighlighter Sep 10, 2020
@shilman shilman merged commit 586b08e into storybookjs:next Sep 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants