Skip to content

Add extraHeadTags prop #229

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/core/components/canvas/static/HeadTags.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { map } from "lodash-es";
import { useEffect, useMemo, useState } from "react";
import { useFrame } from "../../../frame";
import { useDarkMode, useSelectedBlockIds, useSelectedStylingBlocks } from "../../../hooks";
import {useBuilderProp, useDarkMode, useSelectedBlockIds, useSelectedStylingBlocks} from "../../../hooks";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

apply prettier

import { useAtom } from "jotai";
import typography from "@tailwindcss/typography";
import forms from "@tailwindcss/forms";
Expand All @@ -10,13 +10,14 @@ import containerQueries from "@tailwindcss/container-queries";
import { draggedBlockAtom, dropTargetBlockIdAtom } from "../dnd/atoms.ts";
import plugin from "tailwindcss/plugin";
import { getChaiThemeOptions, getChaiThemeCssVariables, getThemeFontsLinkMarkup } from "./ChaiThemeFn.ts";
import { useTheme, useThemeOptions } from "../../../hooks/useTheme.ts";
import { useTheme, useThemeOptions } from "../../../hooks";
import { ChaiBuilderThemeValues } from "../../../types/chaiBuilderEditorProps.ts";
import { pick } from "lodash-es";
// @ts-ignore

export const HeadTags = () => {
const [chaiTheme] = useTheme();
const extraHeadTags = useBuilderProp("extraHeadTags", <></>);

const chaiThemeOptions = useThemeOptions();
// console.log(chaiTheme, chaiThemeOptions);
Expand Down Expand Up @@ -127,6 +128,7 @@ export const HeadTags = () => {
<>
<style id="chai-theme">{themeVariables}</style>
<span id="chai-fonts" dangerouslySetInnerHTML={{ __html: fonts }} />
{extraHeadTags}
</>
);
};
2 changes: 2 additions & 0 deletions src/core/types/chaiBuilderEditorProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,4 +272,6 @@ export interface ChaiBuilderEditorProps {
*/
pageTypes?: PageType[];
searchPageTypeItems?: (pageTypeKey: string, query: string) => Promise<PageTypeItem[] | Error>;

extraHeadTags?: ReactNode;
}