Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

fix scrolling and styling of the docs home page AI prompt (#8785)

Adrian Kahali4658ed6ee394
diff --git a/docs/snippets/home.jsx b/docs/snippets/home.jsx
index 8952b2ee65..7173875751 100644
--- a/docs/snippets/home.jsx
+++ b/docs/snippets/home.jsx
@@ -173,6 +173,27 @@ export const HomeSteps = ({ steps, panels }) => {
// into an agent preserves the code fencing.
export const PromptBlock = ({ text }) => {
const [status, setStatus] = useState(null);
+ const bodyRef = useRef(null);
+
+ useEffect(() => {
+ const body = bodyRef.current;
+ if (!body) return undefined;
+ const update = () => {
+ const remaining = body.scrollHeight - body.clientHeight - body.scrollTop;
+ body.style.setProperty("--ifx-prompt-fade-top", `${Math.min(body.scrollTop, 32)}px`);
+ body.style.setProperty("--ifx-prompt-fade-bottom", `${Math.min(Math.max(remaining, 0), 32)}px`);
+ };
+ update();
+ body.addEventListener("scroll", update, { passive: true });
+ const observer = new ResizeObserver(update);
+ observer.observe(body);
+ Array.from(body.children).forEach((child) => observer.observe(child));
+ return () => {
+ body.removeEventListener("scroll", update);
+ observer.disconnect();
+ };
+ }, []);
+
const copy = async () => {
try {
await navigator.clipboard.writeText(text);
@@ -185,7 +206,7 @@ export const PromptBlock = ({ text }) => {
const paragraphs = text.split("\n\n");
return (
<div className="ifx-prompt">
- <div className="ifx-prompt__body">
+ <div className="ifx-prompt__body" ref={bodyRef}>
{paragraphs.map((paragraph, i) => (
<p key={i} className="ifx-prompt__p">
{paragraph.split(/(`[^`]+`)/g).map((segment, j) =>
diff --git a/docs/style.css b/docs/style.css
index 9c62f3587d..9230a9e389 100644
--- a/docs/style.css
+++ b/docs/style.css
@@ -406,19 +406,37 @@ html.dark[data-current-path="/"] #navbar .nav-tabs-item[data-active="true"]:hove
flex-direction: column;
flex: 1;
min-height: 0;
- padding: 0.75rem 2.5rem 0.75rem 0.875rem;
- background-color: #fbfbfa;
- border: 1px solid #ebebeb;
- border-radius: 6px;
+ overflow: hidden;
+ background-color: var(--ifx-surface);
+ border: 1px solid var(--ifx-line);
font-size: 0.8125rem;
line-height: 1.55;
- color: #26272b;
+ color: var(--ifx-text-dim);
}
.ifx-prompt__body {
flex: 1;
min-height: 0;
+ padding: 0.75rem 3rem 0.75rem 0.875rem;
+ overflow-x: hidden;
overflow-y: auto;
+ scrollbar-width: thin;
+ --ifx-prompt-fade-top: 0px;
+ --ifx-prompt-fade-bottom: 0px;
+ -webkit-mask-image: linear-gradient(
+ to bottom,
+ transparent,
+ black var(--ifx-prompt-fade-top),
+ black calc(100% - var(--ifx-prompt-fade-bottom)),
+ transparent
+ );
+ mask-image: linear-gradient(
+ to bottom,
+ transparent,
+ black var(--ifx-prompt-fade-top),
+ black calc(100% - var(--ifx-prompt-fade-bottom)),
+ transparent
+ );
}
.ifx-prompt__p {
@@ -431,17 +449,16 @@ html.dark[data-current-path="/"] #navbar .nav-tabs-item[data-active="true"]:hove
.ifx-prompt__code {
padding: 0.05rem 0.3rem;
- border-radius: 3px;
- background-color: #ebebeb;
+ background-color: var(--ifx-control-line);
font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
font-size: 0.72rem;
- color: #171718;
+ color: var(--ifx-text-dim);
}
.ifx-prompt__copy {
position: absolute;
- top: 0;
- right: 0;
+ top: 0.375rem;
+ right: 0.5rem;
display: flex;
align-items: center;
justify-content: center;
@@ -449,37 +466,15 @@ html.dark[data-current-path="/"] #navbar .nav-tabs-item[data-active="true"]:hove
height: 2rem;
padding: 0;
border: 0;
- border-bottom-left-radius: 4px;
- background-color: rgba(251, 251, 250, 0.95);
- color: #6f6f6f;
+ background-color: transparent;
+ color: var(--ifx-muted);
cursor: pointer;
transition: color 0.2s, background-color 0.2s;
}
.ifx-prompt__copy:hover {
- color: #171718;
- background-color: #f4f4f4;
-}
-
-.dark .ifx-prompt {
- background-color: rgba(255, 255, 255, 0.03);
- border-color: rgba(255, 255, 255, 0.1);
- color: #dfdfdf;
-}
-
-.dark .ifx-prompt__code {
- background-color: rgba(255, 255, 255, 0.08);
- color: #f4f4f4;
-}
-
-.dark .ifx-prompt__copy {
- background-color: rgba(23, 23, 24, 0.95);
- color: #adaeb0;
-}
-
-.dark .ifx-prompt__copy:hover {
- color: #f4f4f4;
- background-color: rgba(255, 255, 255, 0.06);
+ color: var(--ifx-control-text-hover);
+ background-color: var(--ifx-hover-fill);
}
.ifx-steps__prose p {
@@ -618,7 +613,6 @@ a.ifx-steps__label:hover {
height: 2rem;
border-left: 0;
border-bottom: 1px solid #ebebeb;
- border-bottom-left-radius: 4px;
background-color: rgba(251, 251, 250, 0.92);
}