🎥 Make videos programmatically with React
Elements: Replace drag action with compact handle
Igor Samokhovets197f82bdf043
diff --git a/packages/docs/src/components/Elements/ElementPage.module.css b/packages/docs/src/components/Elements/ElementPage.module.cssindex ff00ac8bc1..f1a09bfac2 100644--- a/packages/docs/src/components/Elements/ElementPage.module.css+++ b/packages/docs/src/components/Elements/ElementPage.module.css@@ -97,23 +97,31 @@.actionRow {display: flex;- flex-wrap: wrap;- align-items: center;+ align-items: flex-start;+ gap: 10px;+}++.actionButtons {+ display: flex;+ flex: 1;+ flex-direction: column;gap: 10px;+ min-width: 0;}.dragHandle {- position: relative;display: flex;align-items: center;- margin-top: 8px;- padding: 8px 40px;+ justify-content: center;+ width: 46px;+ height: 46px;+ flex: none;border: 1px solid var(--ifm-color-emphasis-300);- border-radius: 8px;+ border-radius: 50%;background: var(--ifm-background-surface-color);+ box-shadow: 0 2px 5px rgb(0 0 0 / 12%);color: var(--ifm-color-emphasis-800);cursor: grab;- font-size: 0.8125rem;user-select: none;}@@ -131,31 +139,14 @@}.dragHandleIcon {- position: absolute;- left: 12px;- top: 50%;font-size: 1.5rem;line-height: 1;- transform: translateY(-50%);}[data-theme='dark'] .dragHandleIcon {color: var(--ifm-color-emphasis-500);}-.dragHandleText {- display: flex;- flex: 1;- flex-direction: column;- line-height: 1.3;- text-align: center;- white-space: nowrap;-}--.dragHandleText strong {- font-weight: 600;-}-.successStatus,.errorStatus {margin: 12px 0 0;@@ -171,9 +162,7 @@}.details {- margin-top: 16px;- padding-top: 16px;- border-top: 1px solid var(--ifm-color-emphasis-200);+ margin-top: 32px;}.description {@@ -225,11 +214,6 @@overflow-wrap: anywhere;}-.dependencyList li::marker {- color: var(--ifm-color-primary);- font-size: 0.85em;-}-.dependencyList li + li {margin-top: 4px;}@@ -301,7 +285,6 @@}@container actions-column (max-width: 400px) {- .actionsColumn .actionRow,.actionsColumn .contributors,.actionsColumn .contributorList {align-items: stretch;@@ -314,11 +297,6 @@height: 160px;}- .actionRow {- align-items: stretch;- flex-direction: column;- }-.contributors {align-items: flex-start;flex-direction: column;diff --git a/packages/docs/src/components/Elements/ElementPage.tsx b/packages/docs/src/components/Elements/ElementPage.tsxindex 144cec0eea..608ba3263c 100644--- a/packages/docs/src/components/Elements/ElementPage.tsx+++ b/packages/docs/src/components/Elements/ElementPage.tsx@@ -214,51 +214,54 @@ export const ElementPage: React.FC<ElementPageProps> = ({{elementPayload === null ? null : (<><div className={styles.actionRow}>- <BlueButton- fullWidth- loading={installStatus.type === 'installing'}- onClick={installElement}- size="sm"- style={{padding: '7px 12px'}}- title="Install in the most recently focused Remotion Studio"- >- {installStatus.type === 'installing'- ? 'Finding Studio…'- : 'Install in Studio'}- </BlueButton>- {isBrowserStudioActionVisible ? (- <PlainButton+ <div className={styles.actionButtons}>+ <BlueButtonfullWidth- loading={false}- onClick={openInBrowserStudio}+ loading={installStatus.type === 'installing'}+ onClick={installElement}size="sm"style={{padding: '7px 12px'}}+ title="Install in the most recently focused Remotion Studio"+ >+ {installStatus.type === 'installing'+ ? 'Finding Studio…'+ : 'Install in Studio'}+ </BlueButton>+ {isBrowserStudioActionVisible ? (+ <PlainButton+ fullWidth+ loading={false}+ onClick={openInBrowserStudio}+ size="sm"+ style={{padding: '7px 12px'}}+ >+ Open in Browser Studio+ </PlainButton>+ ) : null}+ </div>+ {isEmbeddedInStudio === false ? (+ <div+ aria-label="Drag into Studio"+ className={styles.dragHandle}+ draggable+ onDragStart={(event) => {+ setStudioDragData({+ dataTransfer: event.dataTransfer,+ payload: elementPayload,+ });+ setElementDragImage(+ event.dataTransfer,+ posterRef.current,+ );+ }}+ title="Drag into your Studio browser tab to choose where the element is placed on the canvas or timeline">- Open in Browser Studio- </PlainButton>+ <span aria-hidden="true" className={styles.dragHandleIcon}>+ ⠿+ </span>+ </div>) : null}</div>- {isEmbeddedInStudio === false ? (- <div- className={styles.dragHandle}- draggable- onDragStart={(event) => {- setStudioDragData({- dataTransfer: event.dataTransfer,- payload: elementPayload,- });- setElementDragImage(event.dataTransfer, posterRef.current);- }}- title="Drag into your Studio browser tab to choose where the element is placed on the canvas or timeline"- >- <span aria-hidden="true" className={styles.dragHandleIcon}>- ⠿- </span>- <span className={styles.dragHandleText}>- <strong>Drag into Studio</strong>- </span>- </div>- ) : null}{installStatus.type === 'success' ||installStatus.type === 'error' ? (<p