-
Notifications
You must be signed in to change notification settings - Fork 832
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
9 changed files
with
146 additions
and
3 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
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,81 @@ | ||
import { PlayIcon, SpinnerIcon } from "@webstudio-is/icons/svg"; | ||
import { type TemplateMeta, $, css } from "@webstudio-is/template"; | ||
|
||
export const meta: TemplateMeta = { | ||
category: "media", | ||
order: 1, | ||
description: | ||
"Add a video to your page that is hosted on Vimeo. Paste a Vimeo URL and configure the video in the Settings tab.", | ||
template: ( | ||
<$.YouTube | ||
ws:style={css` | ||
position: relative; | ||
aspect-ratio: 640/360; | ||
width: 100%; | ||
`} | ||
> | ||
<$.VimeoPreviewImage | ||
ws:label="Preview Image" | ||
ws:style={css` | ||
position: absolute; | ||
object-fit: cover; | ||
object-position: cover; | ||
width: 100%; | ||
height: 100%; | ||
border-radius: 20px; | ||
`} | ||
alt="Vimeo video preview image" | ||
sizes="100vw" | ||
/> | ||
<$.VimeoSpinner | ||
ws:label="Spinner" | ||
ws:style={css` | ||
position: absolute; | ||
top: 50%; | ||
left: 50%; | ||
width: 70px; | ||
height: 70px; | ||
margin-top: -35px; | ||
margin-left: -35px; | ||
`} | ||
> | ||
<$.HtmlEmbed ws:label="Spinner SVG" code={SpinnerIcon} /> | ||
</$.VimeoSpinner> | ||
<$.VimeoPlayButton | ||
ws:label="Play Button" | ||
ws:style={css` | ||
position: absolute; | ||
width: 140px; | ||
height: 80px; | ||
top: 50%; | ||
left: 50%; | ||
margin-top: -40px; | ||
margin-left: -70px; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
border-style: none; | ||
border-radius: 5px; | ||
cursor: pointer; | ||
background-color: rgb(18, 18, 18); | ||
color: rgb(255, 255, 255); | ||
&:hover { | ||
background-color: rgb(0, 173, 239); | ||
} | ||
`} | ||
aria-label="Play button" | ||
> | ||
<$.Box | ||
ws:label="Play Icon" | ||
ws:style={css` | ||
width: 60px; | ||
height: 60px; | ||
`} | ||
aria-hidden={true} | ||
> | ||
<$.HtmlEmbed ws:label="Play SVG" code={PlayIcon} /> | ||
</$.Box> | ||
</$.VimeoPlayButton> | ||
</$.YouTube> | ||
), | ||
}; |
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,58 @@ | ||
import type { ComponentProps } from "react"; | ||
import { Youtube1cIcon } from "@webstudio-is/icons/svg"; | ||
import { | ||
defaultStates, | ||
type PresetStyle, | ||
type WsComponentMeta, | ||
type WsComponentPropsMeta, | ||
} from "@webstudio-is/sdk"; | ||
import { div } from "@webstudio-is/sdk/normalize.css"; | ||
import { props } from "./__generated__/youtube.props"; | ||
import type { YouTube } from "./youtube"; | ||
|
||
const presetStyle = { | ||
div, | ||
} satisfies PresetStyle<"div">; | ||
|
||
export const meta: WsComponentMeta = { | ||
type: "container", | ||
icon: Youtube1cIcon, | ||
states: defaultStates, | ||
presetStyle, | ||
constraints: { | ||
relation: "ancestor", | ||
component: { $nin: ["Button", "Link", "Heading"] }, | ||
}, | ||
}; | ||
|
||
const initialProps: Array<keyof ComponentProps<typeof YouTube>> = [ | ||
"id", | ||
"className", | ||
"url", | ||
"loading", | ||
"showPreview", | ||
"autoplay", | ||
"showControls", | ||
"showRelatedVideos", | ||
"keyboard", | ||
"loop", | ||
"playsinline", | ||
"allowFullscreen", | ||
"showCaptions", | ||
"showAnnotations", | ||
"startTime", | ||
"endTime", | ||
"disableKeyboard", | ||
"referrer", | ||
"listType", | ||
"listId", | ||
"origin", | ||
"captionLanguage", | ||
"language", | ||
"color", | ||
]; | ||
|
||
export const propsMeta: WsComponentPropsMeta = { | ||
props, | ||
initialProps, | ||
}; |