-
Notifications
You must be signed in to change notification settings - Fork 27.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updating Third party capital version. (#54418)
Updated Third-party-capital version. Refactored `next/third-parties` to update the way components are built. Updated tests. cc: @kara @huozhi @gnoff
- Loading branch information
1 parent
30937ee
commit d3a1079
Showing
16 changed files
with
94 additions
and
193 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 was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import React from 'react' | ||
import { GoogleMapsEmbed as TPCGoogleMapEmbed } from 'third-party-capital' | ||
|
||
import ThirdPartyScriptEmbed from '../ThirdPartyScriptEmbed' | ||
import { GoogleMapsEmbed as GoogleMapsEmbedTypes } from '../types/google' | ||
|
||
export default function GoogleMapsEmbed(props: GoogleMapsEmbedTypes) { | ||
const { apiKey, ...restProps } = props | ||
const formattedProps = { ...restProps, key: apiKey } | ||
const { html } = TPCGoogleMapEmbed(formattedProps) | ||
|
||
return ( | ||
<ThirdPartyScriptEmbed | ||
height={formattedProps.height || null} | ||
width={formattedProps.width || null} | ||
html={html} | ||
dataNtpc="GoogleMapsEmbed" | ||
></ThirdPartyScriptEmbed> | ||
) | ||
} |
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,34 @@ | ||
import React from 'react' | ||
import Script, { ScriptProps } from 'next/script' | ||
import { YouTubeEmbed as TPCYouTubeEmbed } from 'third-party-capital' | ||
|
||
import ThirdPartyScriptEmbed from '../ThirdPartyScriptEmbed' | ||
import { YouTubeEmbed as YouTubeEmbedTypes } from '../types/google' | ||
|
||
const scriptStrategy = { | ||
server: 'beforeInteractive', | ||
client: 'afterInteractive', | ||
idle: 'lazyOnload', | ||
worker: 'worker', | ||
} | ||
|
||
export default function YouTubeEmbed(props: YouTubeEmbedTypes) { | ||
const { html, scripts, stylesheets } = TPCYouTubeEmbed(props) | ||
|
||
return ( | ||
<ThirdPartyScriptEmbed | ||
height={props.height || null} | ||
width={props.width || null} | ||
html={html} | ||
dataNtpc="YouTubeEmbed" | ||
> | ||
{scripts?.map((script) => ( | ||
<Script | ||
src={script.url} | ||
strategy={scriptStrategy[script.strategy] as ScriptProps['strategy']} | ||
stylesheets={stylesheets} | ||
/> | ||
))} | ||
</ThirdPartyScriptEmbed> | ||
) | ||
} |
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 |
---|---|---|
@@ -1,39 +1,2 @@ | ||
/** | ||
* This is an autogenerated file by update-third-parties.js | ||
*/ | ||
import React from 'react' | ||
import Script from 'next/script' | ||
|
||
import ThirdPartyScriptEmbed from '../ThirdPartyScriptEmbed' | ||
import * as Types from '../types/google' | ||
|
||
// Embed a Google Maps embed on your webpage | ||
export function GoogleMapsEmbed(args: Types.GoogleMapsEmbed) { | ||
return ( | ||
<ThirdPartyScriptEmbed | ||
height={args.height || null} | ||
width={args.width || null} | ||
content={`<iframe loading="lazy" src="https://www.google.com/maps/embed/v1/${args.mapMode}?key=${args.apiKey}&${args.parameters}" width=${args.width} height=${args.height} style=${args.style} allowfullscreen=${args.allowfullscreen} referrerpolicy="no-referrer-when-downgrade"></iframe>`} | ||
dataNtpc="GoogleMapsEmbed" | ||
></ThirdPartyScriptEmbed> | ||
) | ||
} | ||
// Embed a YouTube embed on your webpage. | ||
export function YoutubeEmbed(args: Types.YoutubeEmbed) { | ||
return ( | ||
<ThirdPartyScriptEmbed | ||
height={args.height || null} | ||
width={args.width || null} | ||
content={`<lite-youtube videoid=${args.videoid} playlabel=${args.playlabel}></lite-youtube>`} | ||
dataNtpc="YoutubeEmbed" | ||
> | ||
<Script | ||
src={`https://cdn.jsdelivr.net/gh/paulirish/lite-youtube-embed@master/src/lite-yt-embed.js`} | ||
strategy="lazyOnload" | ||
stylesheets={[ | ||
'https://cdn.jsdelivr.net/gh/paulirish/lite-youtube-embed@master/src/lite-yt-embed.css', | ||
]} | ||
/> | ||
</ThirdPartyScriptEmbed> | ||
) | ||
} | ||
export { default as GoogleMapsEmbed } from './GoogleMapsEmbed' | ||
export { default as YouTubeEmbed } from './YouTubeEmbed' |
This file was deleted.
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
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
Oops, something went wrong.