Skip to content

fix: update scrollbar for code blocks - #4785

Merged
carlagn merged 22 commits into
mainfrom
fix/codeblock-scrollbar
Jun 16, 2023
Merged

fix: update scrollbar for code blocks#4785
carlagn merged 22 commits into
mainfrom
fix/codeblock-scrollbar

Conversation

@carlagn

@carlagn carlagn commented May 19, 2023

Copy link
Copy Markdown
Contributor

Describe this PR

Horizontal scrollbar for code blocks is not currently uniformed in behaviour or appearance.

Changes

Update code component to have a generalised scrollbar look and behaviour, one which is already in place at @prisma/blog as well.

Added wrap prop on codeblock components for cases where we have code blocks that have only one line or we want to wrap the text depending on the context.

⚠️ This should be defined by the docs writers.

i.e. in cases such as this code block, it wouldn't make sense to have the full line scrollable, since it'd just make it harder to read or copy.

For #1015:

prod fixed
image Screenshot 2023-05-19 at 11 30 24

For #1023 We changed the behaviour to always display a scrollbar in case it contains large code inside. As it is now, the user needs to scroll inside to make the scrollbar visible, but it is not 100% obvious it is a codeblock with large content.

prod - no inside scroll prod - inside scroll fixed
Screenshot 2023-05-19 at 11 35 39 https://github.com/prisma/docs/assets/14851246/19c46b0c-b197-4c49-a443-4c6e7b27369e Screenshot 2023-05-19 at 11 35 33

What issue does this fix?

Fixes #1023 #1015

Any other relevant information

N/a

@vercel

vercel Bot commented May 19, 2023

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 15, 2023 3:40pm

@carlagn carlagn changed the title Update scrollbar for code blocks fix: update scrollbar for code blocks May 19, 2023
@carlagn
carlagn requested a review from nilubava May 19, 2023 10:26
@github-actions

github-actions Bot commented May 19, 2023

Copy link
Copy Markdown
Contributor

This PR changes the following pages (Vercel Preview Deploy links):

Changed Vercel links

(Note that links will only be valid after Vercel preview deploy succeeded)

@carlagn
carlagn requested a review from meletj May 19, 2023 10:26
@github-actions

Copy link
Copy Markdown
Contributor

This PR probably requires the following redirects to be added to vercel.json:

  • This PR does not change any pages in a way that would require a redirect.

@carlagn
carlagn requested a review from nilubava May 31, 2023 16:22
@nilubava

nilubava commented Jun 7, 2023

Copy link
Copy Markdown
Contributor

@ruheni Could you please review this PR and make sure the comment using wrap property makes sense for doc writers?

@meletj

meletj commented Jun 7, 2023

Copy link
Copy Markdown
Contributor

@ruheni Could you please review this PR and make sure the comment using wrap property makes sense for doc writers?

@nilubava where will you document this so Docs writers know to use the wrap property?

@meletj

meletj commented Jun 8, 2023

Copy link
Copy Markdown
Contributor

I believe this would also fix this issue #1446 ie it looks like the wrap option was a request already.

@meletj meletj linked an issue Jun 8, 2023 that may be closed by this pull request
@ruheni

ruheni commented Jun 12, 2023

Copy link
Copy Markdown
Contributor

The wrap property makes sense to have for code snippets. Sharing the update in the #docs and #team-dev-advocacy(reposting) channels would help create visibility. I would also happily mention it in our team sync once this is merged.

@carlagn
carlagn force-pushed the fix/codeblock-scrollbar branch from 44b5f75 to 362195e Compare June 15, 2023 14:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

5 participants