chore: ignore dynamic content on chromatic (#16214)

This commit is contained in:
Bruno Quaresma
2025-01-21 15:22:06 -03:00
committed by GitHub
parent f8844cab0a
commit 0fa6b3df13
4 changed files with 14 additions and 5 deletions
@@ -128,7 +128,9 @@ const ErrorStack: FC<ErrorStackProps> = ({ error }) => {
</p>
{error.stack && (
<pre className="m-0 py-2 px-0 overflow-x-auto text-xs">
<code data-testid="code">{error.stack}</code>
<code data-testid="code" data-chromatic="ignore">
{error.stack}
</code>
</pre>
)}
</>
@@ -1,15 +1,18 @@
import isChromatic from "chromatic/isChromatic";
import type { FC } from "react";
import { Helmet } from "react-helmet-async";
import { pageTitle } from "utils/page";
import { CliInstallPageView } from "./CliInstallPageView";
export const CliInstallPage: FC = () => {
const origin = isChromatic() ? "https://example.com" : window.location.origin;
return (
<>
<Helmet>
<title>{pageTitle("Install the Coder CLI")}</title>
</Helmet>
<CliInstallPageView />
<CliInstallPageView origin={origin} />
</>
);
};
@@ -4,6 +4,9 @@ import { CliInstallPageView } from "./CliInstallPageView";
const meta: Meta<typeof CliInstallPageView> = {
title: "pages/CliInstallPage",
component: CliInstallPageView,
args: {
origin: "https://example.com",
},
};
export default meta;
@@ -4,9 +4,11 @@ import { Welcome } from "components/Welcome/Welcome";
import type { FC } from "react";
import { Link as RouterLink } from "react-router-dom";
export const CliInstallPageView: FC = () => {
const origin = location.origin;
type CliInstallPageViewProps = {
origin: string;
};
export const CliInstallPageView: FC<CliInstallPageViewProps> = ({ origin }) => {
return (
<div css={styles.container}>
<Welcome>Install the Coder CLI</Welcome>
@@ -18,7 +20,6 @@ export const CliInstallPageView: FC = () => {
<CodeExample
css={{ maxWidth: "100%" }}
data-chromatic="ignore"
code={`curl -fsSL ${origin}/install.sh | sh`}
secret={false}
/>