Skip to content

Commit 5dafe11

Browse files
committed
feat: add isAstro flag
This allows us to change logic in components based on the renderer
1 parent 4e3629f commit 5dafe11

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

packages/website/astro.config.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ const cspConfig = process.env['NODE_ENV'] === 'development' ? cspDevConfig : csp
4747
// generation of the content collections.
4848
globalThis.unlistedPages = new Set();
4949

50+
globalThis.isAstro = true;
51+
5052
// https://astro.build/config
5153
export default defineConfig({
5254
publicDir: '../../static',

packages/website/src/env.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,6 @@ declare global {
88
* generation of the content collections.
99
*/
1010
var unlistedPages: Set<string>;
11+
12+
var isAstro: boolean | undefined;
1113
}

src/components/ComponentPage.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,8 @@ interface IntroductionProps extends ComponentPageSectionProps {
198198
export const Introduction = ({ component, headingLevel, description }: IntroductionProps) => {
199199
const relayStep = component && COMPONENT_STATES[component.relayStep];
200200

201+
if (globalThis.isAstro) return null;
202+
201203
return (
202204
component && (
203205
<>

0 commit comments

Comments
 (0)