-
Notifications
You must be signed in to change notification settings - Fork 185
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Support custom frame URLs (#163)
- Loading branch information
1 parent
f5ad5ff
commit 8fc0b83
Showing
2 changed files
with
24 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* eslint-disable-next-line import/no-unresolved */ | ||
// @ts-ignore | ||
import { frameSrc } from '__PLAYROOM_ALIAS__FRAME_COMPONENT__'; | ||
|
||
interface FrameParams { | ||
code: string; | ||
themeName: string; | ||
} | ||
const defaultFrameSrc = ( | ||
{ code, themeName }: FrameParams, | ||
{ baseUrl, paramType }: InternalPlayroomConfig | ||
) => | ||
`${baseUrl}frame.html${ | ||
paramType === 'hash' ? '#' : '' | ||
}?themeName=${encodeURIComponent(themeName)}&code=${encodeURIComponent( | ||
code | ||
)}`; | ||
|
||
export default frameSrc ? frameSrc : defaultFrameSrc; |