-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
235 additions
and
70 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { Button, MenuButton, Menu, MenuItem, MenuDivider } from '@sanity/ui' | ||
import { EllipsisVerticalIcon, ResetIcon, ClipboardIcon, SearchIcon } from '@sanity/icons' | ||
|
||
export function AssetMenu({ | ||
onAction, | ||
}: { | ||
onAction: (action) => void | ||
}) { | ||
return ( | ||
<MenuButton | ||
button={ | ||
<Button | ||
padding={2} | ||
mode="ghost" | ||
icon={EllipsisVerticalIcon} | ||
tone="default" | ||
/> | ||
} | ||
id="asset-menu" | ||
menu={ | ||
<Menu> | ||
<MenuItem | ||
text="Replace media" | ||
icon={SearchIcon} | ||
onClick={() => { | ||
onAction({ type: 'select' }) | ||
}} | ||
/> | ||
<MenuItem | ||
text="Copy emebd URL" | ||
icon={ClipboardIcon} | ||
onClick={() => { | ||
onAction({ type: 'copyUrl' }) | ||
}} | ||
/> | ||
<MenuDivider /> | ||
<MenuItem | ||
text="Clear field" | ||
icon={ResetIcon} | ||
tone="critical" | ||
onClick={() => { | ||
onAction({ type: 'delete' }) | ||
}} | ||
/> | ||
</Menu> | ||
} | ||
/> | ||
) | ||
} |
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,54 @@ | ||
const playerUrl = (videoUrl: string) => { | ||
let params = new URLSearchParams() | ||
|
||
// https://wistia.com/support/developers/embed-options#options | ||
let wistiaSettings = { | ||
playbar: true, | ||
playButton: true, | ||
seo: false, | ||
controlsVisibleOnLoad: true, | ||
autoPlay: false, | ||
doNotTrack: true, | ||
preload: 'none', | ||
volumeControl: true, | ||
copyLinkAndThumbnailEnabled: true, | ||
fullscreenButton: true, | ||
} | ||
|
||
for (let key in wistiaSettings) { | ||
params.append(key, wistiaSettings[key]) | ||
} | ||
|
||
return `${videoUrl}?${params.toString()}` | ||
} | ||
|
||
export function Player({ | ||
videoUrl, | ||
}: { | ||
videoUrl: string | ||
}) { | ||
return ( | ||
<div style={{ | ||
position: 'relative', | ||
paddingTop: '56.25%', | ||
height: '0', | ||
}}> | ||
<iframe | ||
allow="autoplay; fullscreen" | ||
style={{ | ||
width: '100%', | ||
height: '100%', | ||
position: 'absolute', | ||
top: '0', | ||
right: '0', | ||
bottom: '0', | ||
left: '0', | ||
border: '0', | ||
display: 'block', | ||
borderRadius: '3px' | ||
}} | ||
src={playerUrl(videoUrl) || ''} | ||
/> | ||
</div> | ||
) | ||
} |
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.