🎥 Make videos programmatically with React
Elements: Add drag handle callout
JonnyBurger8e35ac82ea96
diff --git a/packages/docs/src/components/Elements/ElementInstallFallbackModal.tsx b/packages/docs/src/components/Elements/ElementInstallFallbackModal.tsxindex 90fd94fa4f..3f62bcad0f 100644--- a/packages/docs/src/components/Elements/ElementInstallFallbackModal.tsx+++ b/packages/docs/src/components/Elements/ElementInstallFallbackModal.tsx@@ -100,6 +100,7 @@ export const ElementInstallFallbackModal: React.FC<{onClick={onInstall}payload={payload}posterRef={posterRef}+ showDragCallout={false}showDragHandletitle="Install in the most recently focused Remotion Studio"/>diff --git a/packages/docs/src/components/Elements/ElementPage.tsx b/packages/docs/src/components/Elements/ElementPage.tsxindex d815bb8ff6..c426622ffc 100644--- a/packages/docs/src/components/Elements/ElementPage.tsx+++ b/packages/docs/src/components/Elements/ElementPage.tsx@@ -261,6 +261,7 @@ export const ElementPage: React.FC<ElementPageProps> = ({onClick={installElement}payload={elementPayload}posterRef={posterRef}+ showDragCalloutshowDragHandle={isEmbeddedInStudio === false}title={isEmbeddedInStudiodiff --git a/packages/docs/src/components/Elements/ElementStudioAction.module.css b/packages/docs/src/components/Elements/ElementStudioAction.module.cssindex 2be6608c71..0353349c04 100644--- a/packages/docs/src/components/Elements/ElementStudioAction.module.css+++ b/packages/docs/src/components/Elements/ElementStudioAction.module.css@@ -1,4 +1,5 @@.studioAction {+ position: relative;display: flex;align-items: stretch;width: 100%;@@ -6,6 +7,10 @@background: var(--blue-underlay);}+.studioActionWithCallout {+ margin-bottom: 68px;+}+.studioAction .buttonWithDragHandle {border-top-right-radius: 0;border-right-width: 0;@@ -68,3 +73,31 @@font-size: 1.5rem;line-height: 1;}++.dragCallout {+ position: absolute;+ top: calc(100% + 1px);+ right: 20px;+ width: 31px;+ height: 64px;+ color: var(--text-color);+ pointer-events: none;+}++.dragCalloutLine {+ display: block;+ width: 31px;+ height: 64px;+ overflow: visible;+}++.dragCalloutLabel {+ position: absolute;+ top: 32px;+ right: 38px;+ width: max-content;+ font-family: 'GTPlanar';+ font-size: 15px;+ line-height: 1.2;+ white-space: nowrap;+}diff --git a/packages/docs/src/components/Elements/ElementStudioAction.tsx b/packages/docs/src/components/Elements/ElementStudioAction.tsxindex f290b6ae6f..d93251e4d6 100644--- a/packages/docs/src/components/Elements/ElementStudioAction.tsx+++ b/packages/docs/src/components/Elements/ElementStudioAction.tsx@@ -13,6 +13,7 @@ export const ElementStudioAction: React.FC<{readonly onClick: () => void;readonly payload: StudioElementPayload;readonly posterRef: RefObject<HTMLImageElement | null>;+ readonly showDragCallout: boolean;readonly showDragHandle: boolean;readonly title: string;}> = ({@@ -21,9 +22,11 @@ export const ElementStudioAction: React.FC<{onClick,payload,posterRef,+ showDragCallout,showDragHandle,title,}) => {+ const hasDragCallout = showDragHandle && showDragCallout;const onDragStart = (event: React.DragEvent<HTMLElement>) => {setStudioDragData({dataTransfer: event.dataTransfer,@@ -33,7 +36,9 @@ export const ElementStudioAction: React.FC<{};return (- <div className={styles.studioAction}>+ <div+ className={`${styles.studioAction} ${hasDragCallout ? styles.studioActionWithCallout : ''}`}+ ><BlueButtonclassName={showDragHandle ? styles.buttonWithDragHandle : undefined}draggable={showDragHandle}@@ -60,6 +65,23 @@ export const ElementStudioAction: React.FC<{</span></div>) : null}+ {hasDragCallout ? (+ <div aria-hidden="true" className={styles.dragCallout}>+ <svg+ className={styles.dragCalloutLine}+ fill="none"+ viewBox="0 0 77 160"+ >+ <path+ d="M5 154.5C51 121 79 81 69 5"+ stroke="currentColor"+ strokeLinecap="round"+ strokeWidth="8"+ />+ </svg>+ <span className={styles.dragCalloutLabel}>Drag into Studio</span>+ </div>+ ) : null}</div>);};