-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Import CSS and Inject into Iframe (#412)
This PR adds user styling into the preview iframe. First, Studio dynamically imports user CSS and adds it to the head of Studio as a disabled style tag. Then, the `IframePortal` injects the style into the preview panel depending on the page CSS and the CSS of the components in the component tree. Note that this PR would break acceptance test screenshots since Tailwind is not currently configured in e2e-tests, so we turned off screenshots in this PR. This will be reverted in the following PR when we add Tailwind. J-SLAP-2912 TEST=manual
- Loading branch information
Showing
23 changed files
with
316 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
packages/studio-plugin/tests/__fixtures__/LayoutFile/BasicLayout.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
packages/studio-plugin/tests/__fixtures__/LayoutFile/index.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
div { | ||
background-color: lightsalmon; | ||
} |
3 changes: 2 additions & 1 deletion
3
packages/studio-plugin/tests/__fixtures__/PageFile/entityTemplate.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
div { | ||
background-color: lightsalmon; | ||
} |
22 changes: 22 additions & 0 deletions
22
packages/studio-plugin/tests/__fixtures__/PageFile/unsupportedCssImport.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import "@yext/search-ui-react/bundle.css"; | ||
import ComplexBanner from "../ComponentFile/ComplexBanner"; | ||
import { GetPath, TemplateConfig, TemplateProps } from "@yext/pages"; | ||
|
||
export const config: TemplateConfig = { | ||
stream: { | ||
$id: "studio-stream-id", | ||
localization: { locales: ["en"] }, | ||
filter: { entityTypes: ["location"] }, | ||
fields: ["title", "slug"], | ||
}, | ||
}; | ||
|
||
export const getPath: GetPath<TemplateProps> = ({ | ||
document, | ||
}: TemplateProps) => { | ||
return document.slug; | ||
}; | ||
|
||
export default function UnsupportedCss({ document }: TemplateProps) { | ||
return <ComplexBanner title={document.title} num={3} bool={false} />; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.