-
Notifications
You must be signed in to change notification settings - Fork 230
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds support for showing the Pulumi Copilot sidebar on the docs site (#…
…12905) - Adds a route to the copilot host so that the iframe is SAMEORIGIN with the docs - This allows it to React.portal into the doc and interact w/ the page a bit. - This requires some tweaks to SecurityPolicy to allow the Copilot path to be iframe'd too
- Loading branch information
Showing
10 changed files
with
156 additions
and
26 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
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
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,5 @@ | ||
{{ $copilotApiUrl := getenv "PULUMI_COPILOT_URL" }} | ||
{{ if $copilotApiUrl }} | ||
<aside id="ai-sidebar-target"></aside> | ||
<iframe id="ai-sidebar-host" src="/_pulumi/cloud-ai/sidebar?hostApp=docs&apiHost={{ $copilotApiUrl | urlquery }}"></iframe> | ||
{{ end }} |
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,38 @@ | ||
// Host iframe | ||
// Should not be shown, when loaded it will portal the content to the sidebar target | ||
#ai-sidebar-host { | ||
display: none | ||
} | ||
|
||
// Element that will be the target of the portal | ||
// If empty it will have a width of 0 and will not be visible. | ||
#ai-sidebar-target { | ||
// Relative to the viewport so copilot moves w/ the scrolling | ||
position: fixed; | ||
|
||
// Popovers on site use z-index: 20 | ||
z-index: 10; | ||
|
||
// Default use up the full height of the viewport | ||
top: 0; | ||
right: 0; | ||
bottom: 0; | ||
} | ||
|
||
// Per page positions | ||
// ------------------ | ||
|
||
// Main page | ||
// --- | ||
|
||
/* FIXME: no section suffix? */ | ||
.section- #ai-sidebar-target { | ||
top: 200px; | ||
} | ||
|
||
// Docs pages | ||
// --- | ||
|
||
.section-docs #ai-sidebar-target { | ||
top: calc(38px + 8px + 8px + 54px); | ||
} |
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