Visualize Your Ideas With Code
docs: add info panels for firefox users (#195)
Tan to the Dashi9e3c10d8bf0e
diff --git a/packages/docs/docs/getting-started/hierarchy.mdx b/packages/docs/docs/getting-started/hierarchy.mdxindex b819780e..ddc5445f 100644--- a/packages/docs/docs/getting-started/hierarchy.mdx+++ b/packages/docs/docs/getting-started/hierarchy.mdx@@ -6,6 +6,7 @@ slug: /hierarchyimport Mermaid from '@theme/Mermaid';import CodeBlock from '@theme/CodeBlock';import ApiSnippet from '@site/src/components/Api/ApiSnippet';+import FirefoxTextWarning from '@site/src/warnings/FirefoxTextWarning';# Scene hierarchy@@ -16,6 +17,8 @@ the Document Object Model used to represent HTML and XML documents.Here's an example of a simple scene hierarchy together with its objectrepresentation:+<FirefoxTextWarning />+<div className="row margin-bottom--md"><div className="col col--6">diff --git a/packages/docs/docs/getting-started/references.mdx b/packages/docs/docs/getting-started/references.mdxindex 6640922d..b883f517 100644--- a/packages/docs/docs/getting-started/references.mdx+++ b/packages/docs/docs/getting-started/references.mdx@@ -3,6 +3,8 @@ sidebar_position: 7slug: /references---+import FirefoxTextWarning from '@site/src/warnings/FirefoxTextWarning';+# ReferencesUsually, when creating a node, we want to store a reference to it, so we can@@ -100,9 +102,8 @@ yield * circle().scale(2, 0.3);```Notice that `circle` is no longer just a variable that points to our circle.-Instead, it's a [signal-like](/docs/signals) function that can-be used to access it. Invoking it without any arguments (`circle()`) returns our-instance.+Instead, it's a [signal-like](/docs/signals) function that can be used to access+it. Invoking it without any arguments (`circle()`) returns our instance.Going back to the example with the more complex scene, we can now rewrite it as:@@ -178,6 +179,8 @@ that we can use to animate all of them.### Custom functions+<FirefoxTextWarning />+`makeRef()` can also be used to return more than one reference from a customfunction component:@@ -213,6 +216,8 @@ fill this object with all the necessary references.## `makeRefs()` function+<FirefoxTextWarning />+Looking at the previous example, you may notice that we had to define the `refs`type twice. First in the `Label` declaration and then again when creating the`label` object:diff --git a/packages/docs/docs/getting-started/signals.mdx b/packages/docs/docs/getting-started/signals.mdxindex 99ea1483..35036acb 100644--- a/packages/docs/docs/getting-started/signals.mdx+++ b/packages/docs/docs/getting-started/signals.mdx@@ -6,6 +6,7 @@ slug: /signalsimport AnimationPlayer from '@site/src/components/AnimationPlayer';import CodeBlock from '@theme/CodeBlock';import signalSource from '!!raw-loader!@motion-canvas/examples/src/scenes/node-signal';+import FirefoxTextWarning from '@site/src/warnings/FirefoxTextWarning';# Signals@@ -110,6 +111,8 @@ We can use the fact that properties of nodes are represented by signals to constBelow you'll find the code used to create this animation. We highlighted all the places where signals are used:+<FirefoxTextWarning />+<CodeBlock language="tsx">{signalSource}</CodeBlock>With this setup, all we need to do is animate the `radius` signal, and the rest of the scene will adjust accordingly:diff --git a/packages/docs/src/warnings/FirefoxTextWarning.tsx b/packages/docs/src/warnings/FirefoxTextWarning.tsxnew file mode 100644index 00000000..0fd20835--- /dev/null+++ b/packages/docs/src/warnings/FirefoxTextWarning.tsx@@ -0,0 +1,17 @@+import React from 'react';+import Admonition from '@site/src/theme/Admonition';+import Link from '@docusaurus/Link';++export default function FirefoxTextWarning() {+ return (+ <Admonition type="caution">+ If you are using Firefox make sure to check if{' '}+ <code>dom.textMetrics.fontBoundingBox</code> is enabled else you might not+ see the{' '}+ <Link to="/api/2d/components/Text">+ <code>Text</code>+ </Link>+ . You can enable this by navigating to <code>about:config</code>.+ </Admonition>+ );+}