Skip to content

Commit 473135e

Browse files
authored
Merge branch 'main' into cd/conditional-content
2 parents 8673edf + ad876f5 commit 473135e

File tree

4 files changed

+104
-10
lines changed

4 files changed

+104
-10
lines changed

fern/assets/styles.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -940,6 +940,12 @@ a[href*="changelog"] svg {
940940
pointer-events: none;
941941
}
942942

943+
/* Fade out effect for AI animation */
944+
.rive-container.fade-bottom {
945+
mask: linear-gradient(to bottom, rgba(0,0,0,1) 70%, rgba(0,0,0,0) 100%);
946+
-webkit-mask: linear-gradient(to bottom, rgba(0,0,0,1) 70%, rgba(0,0,0,0) 100%);
947+
}
948+
943949
.rive-container canvas {
944950
width: 100%;
945951
height: 100%;
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
---
2+
title: Global Variables
3+
---
4+
5+
<Warning>
6+
Global variables are not yet available. Please contact [email protected] if you have any feedback or questions.
7+
</Warning>
8+
9+
Global variables allow you to maintain consistency across your documentation and make updates easier by centralizing commonly used values. You can define and use global variables in several places within Fern documentation.
10+
11+
## Define global variables
12+
13+
Define global variables in your `docs.yml` file:
14+
15+
```yaml docs.yml
16+
variables:
17+
- name: "API_VERSION"
18+
value: "v1"
19+
- name: "API_URL"
20+
value: "https://api.example.com"
21+
```
22+
23+
## Use variables in content
24+
25+
Reference variables throughout your MDX content using double angle brackets:
26+
27+
### In Markdown
28+
29+
````mdx use-api.mdx
30+
Use the latest version of the API: <<API_VERSION>>
31+
32+
```bash
33+
curl -X GET <<API_URL>>/api/<<API_VERSION>>/users
34+
```
35+
````
36+
37+
### In API references
38+
39+
```yaml openapi.yml
40+
paths:
41+
/users:
42+
get:
43+
description: |
44+
The API version is <<API_VERSION>>
45+
responses:
46+
'200':
47+
description: "Success"
48+
content:
49+
application/json:
50+
schema:
51+
```
52+
53+
### In docs.yml configuration
54+
55+
You can also use variables in your `docs.yml` configuration.
56+
57+
```yaml docs.yml
58+
variables:
59+
- name: "ADMIN_ROLE_NAME"
60+
value: "admin"
61+
```
62+
63+
```yaml docs.yml
64+
roles:
65+
- everyone
66+
- <<ADMIN_ROLE_NAME>>
67+
68+
navigation:
69+
- tab: Admin
70+
layout:
71+
- page: Admin Dashboard
72+
path: pages/admin-dashboard.mdx
73+
viewers:
74+
- <<ADMIN_ROLE_NAME>>
75+
```
76+
77+
<Note>
78+
Fern will not render variables in your content if they are not defined in your `docs.yml` configuration. Instead, the variable will be rendered as a literal string.
79+
</Note>

fern/products/home/pages/welcome.mdx

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,11 @@ import { FernFooter } from "../../../components/FernFooter";
132132
</div>
133133

134134
{/* Rive Animation */}
135-
<div class="rive-container">
136-
<canvas id="docs-rive-canvas"></canvas>
137-
</div>
135+
<a href="/docs/getting-started/overview" style="cursor: pointer; text-decoration: none;">
136+
<div class="rive-container fade-bottom">
137+
<canvas id="docs-rive-canvas"></canvas>
138+
</div>
139+
</a>
138140

139141
<div className="action-buttons-vertical">
140142
<a className="fern-button filled normal primary gap-1 w-fit a-btn" href="/docs/getting-started/overview">
@@ -190,9 +192,11 @@ import { FernFooter } from "../../../components/FernFooter";
190192
</div>
191193

192194
{/* Rive Animation */}
193-
<div class="rive-container">
194-
<canvas id="ai-rive-canvas"></canvas>
195-
</div>
195+
<a href="/ask-fern/getting-started/what-is-ask-fern" style="cursor: pointer; text-decoration: none;">
196+
<div class="rive-container fade-bottom">
197+
<canvas id="ai-rive-canvas"></canvas>
198+
</div>
199+
</a>
196200

197201
<div className="action-buttons">
198202
<a className="fern-button filled normal primary gap-1 a-btn" href="/ask-fern/getting-started/what-is-ask-fern">

fern/rive-animation.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,11 @@
128128

129129
// Setup dynamic cursor changes based on Rive's interactive areas
130130
function setupDynamicCursor(canvas, riveInstance, stateMachine) {
131+
// Skip dynamic cursor if canvas is wrapped in an anchor tag
132+
if (canvas.closest('a')) {
133+
return;
134+
}
135+
131136
canvas.addEventListener('mousemove', (event) => {
132137
try {
133138
const rect = canvas.getBoundingClientRect();
@@ -255,7 +260,7 @@
255260
// Docs Animation
256261
createRiveAnimation({
257262
canvasSelector: '#docs-rive-canvas',
258-
riveUrl: 'https://cdn.prod.website-files.com/67880ff570cdb1a85eee946f/68825994c55f0eece04ce4e2_d261956a0f627eb6b94c39aa9fcc26f0_docs_animation.riv',
263+
riveUrl: 'https://cdn.prod.website-files.com/67880ff570cdb1a85eee946f/68825994c55f0eece04ce4e2_9a50e77828a014e927d67fa21d3edf9d_docs_animation.riv',
259264
aspectRatio: 404/262,
260265
stateMachine: "State Machine 1",
261266
fallbackImages: [
@@ -276,7 +281,7 @@
276281
// AI Animation with custom event handling
277282
createRiveAnimation({
278283
canvasSelector: '#ai-rive-canvas',
279-
riveUrl: 'https://cdn.prod.website-files.com/67880ff570cdb1a85eee946f/68825e97fd6225e1c8a7488c_c2966309b38902c92adfe24c2dc8ba5a_ai_animation.riv',
284+
riveUrl: 'https://cdn.prod.website-files.com/67880ff570cdb1a85eee946f/68825e97fd6225e1c8a7488c_c1ab3eed9babdbd0f2333f092d16e2d1_ai_animation.riv',
280285
aspectRatio: 371/99,
281286
stateMachine: "State Machine 1",
282287
fallbackImages: [
@@ -291,13 +296,13 @@
291296
alt: 'AI Animation Preview'
292297
}
293298
],
294-
eventHandlers: {
299+
/* eventHandlers: {
295300
'Open URL': (eventData) => {
296301
// Custom URL handling for AI animation, URL is defined in the Rive file
297302
console.log('AI animation URL event:', eventData.url);
298303
window.open(eventData.url, '_blank', 'noopener,noreferrer');
299304
}
300-
}
305+
} */
301306
});
302307

303308
// Add additional Rive animations by calling createRiveAnimation() with your config

0 commit comments

Comments
 (0)