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

Need way to constrain height / add a scrollbar #7

Closed
zontreck opened this issue Jul 2, 2020 · 1 comment
Closed

Need way to constrain height / add a scrollbar #7

zontreck opened this issue Jul 2, 2020 · 1 comment

Comments

@zontreck
Copy link

zontreck commented Jul 2, 2020

By default it appears that it expands to the code snippet's entire length. This is not ideal for large snippets of code you need to place inside a block while still making the webpage look nice.

rajinwonderland pushed a commit that referenced this issue Jul 8, 2020
… styling #7. Added type="button" prop to the CopyBlock's button component to prevent submission within a form #9. Translated lineNumberStyle to SyntaxHighlighterProps, was initially being passed as a dom property #8
@rajinwonderland rajinwonderland mentioned this issue Jul 9, 2020
@rajinwonderland
Copy link
Owner

Hey @zontreck , two ways you can achieve this!

You can wrap a code block inside a container and constrain it's properties like so:

const MyComp = () => (
  <div style={{ height: '200px', overflowY: 'auto' }}>
    <CodeBlock text="hello world"  showLineNumbers />
  <div>

You can do this on any version! 😄

The alternative would be to upgrade to v0.0.8 and use the customStyle prop, a demo of which I've added onto the CodeBlock's Story for your use-case here

Please note upgrading to the v0.0.8 release require node >= 12!

Let me know if you have any more questions!

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