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

chore: improve yml block readability #168

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 78 additions & 0 deletions apps/docs/src/css/components/codeblock.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
/* Base styles for code blocks */
.rounded.language-yml.theme-code-block,
.rounded.language-yaml.theme-code-block {
min-width: 100%;
width: max-content;
max-width: min(calc(100dvw - 32px), 1000px); /* Reduced side padding for mobile */
z-index: 99;
position: relative;
overflow-x: auto; /* Always allow horizontal scroll */
-webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

/* Style for the code content */
.rounded.language-yml.theme-code-block .prism-code,
.rounded.language-yaml.theme-code-block .prism-code {
max-width: 100%;
overflow-x: auto;
scrollbar-width: thin; /* Firefox */
scrollbar-color: rgba(155, 155, 155, 0.5) transparent; /* Firefox */
}

/* Webkit scrollbar styling */
.rounded.language-yml.theme-code-block .prism-code::-webkit-scrollbar,
.rounded.language-yaml.theme-code-block .prism-code::-webkit-scrollbar {
height: 6px;
width: 6px;
}

.rounded.language-yml.theme-code-block .prism-code::-webkit-scrollbar-track,
.rounded.language-yaml.theme-code-block .prism-code::-webkit-scrollbar-track {
background: transparent;
}

.rounded.language-yml.theme-code-block .prism-code::-webkit-scrollbar-thumb,
.rounded.language-yaml.theme-code-block .prism-code::-webkit-scrollbar-thumb {
background: rgba(155, 155, 155, 0.5);
border-radius: 3px;
}

/* Fade effect for overflow */
.rounded.language-yml.theme-code-block .prism-code:after,
.rounded.language-yaml.theme-code-block .prism-code:after {
content: '';
position: absolute;
right: 0;
top: 0;
bottom: 0;
width: 40px;
background: linear-gradient(to right, transparent, var(--code-bg, #1a1a1a));
opacity: 0.75;
pointer-events: none;
}

/* Media query for mobile devices */
@media (max-width: 768px) {
.rounded.language-yml.theme-code-block,
.rounded.language-yaml.theme-code-block {
font-size: 14px; /* Smaller font size for mobile */
line-height: 1.4;
padding: 12px;
max-width: calc(100dvw - 24px);
}

.rounded.language-yml.theme-code-block .prism-code:after,
.rounded.language-yaml.theme-code-block .prism-code:after {
width: 24px; /* Smaller fade effect on mobile */
}
}

/* Media query for very small screens */
@media (max-width: 380px) {
.rounded.language-yml.theme-code-block,
.rounded.language-yaml.theme-code-block {
font-size: 12px;
padding: 8px;
max-width: calc(100dvw - 16px);
}
}
1 change: 1 addition & 0 deletions apps/docs/src/css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -223,3 +223,4 @@ html[data-theme='dark'] .docsearch-btn:hover {
@import url('./components/sidebar.css');
@import url('./components/toc.css');
@import url('./components/tooltip.css');
@import url('./components/codeblock.css');