π₯ Make videos programmatically with React
Elements: Use blue buttons for Studio actions
JonnyBurger4766c118c081
diff --git a/packages/docs/src/components/Elements/ElementLibrary.module.css b/packages/docs/src/components/Elements/ElementLibrary.module.cssindex 01f6bf8077..1302050c6f 100644--- a/packages/docs/src/components/Elements/ElementLibrary.module.css+++ b/packages/docs/src/components/Elements/ElementLibrary.module.css@@ -31,7 +31,7 @@.installAction {position: absolute;top: calc(100cqi * 9 / 16 - 12px);- left: 12px;+ right: 12px;transform: translateY(calc(-100% + 16px));font-size: 0.75rem;line-height: 1.25;diff --git a/packages/docs/src/components/Elements/ElementLibrary.tsx b/packages/docs/src/components/Elements/ElementLibrary.tsxindex a24acb5dde..9bd357fbd0 100644--- a/packages/docs/src/components/Elements/ElementLibrary.tsx+++ b/packages/docs/src/components/Elements/ElementLibrary.tsx@@ -10,6 +10,7 @@ import React, {useRef,useState,} from 'react';+import {BlueButton} from '../../../components/layout/Button';import type {ElementDefinition} from './element-definitions';import {createElementPayloadFromDefinition,@@ -21,7 +22,6 @@ import {type ElementCategory,} from './element-library-data';import {ELEMENT_PREVIEW_BACKGROUND} from './ElementPreviewComposition';-import {InlineStudioButton} from './InlineStudioButton';import styles from './ElementLibrary.module.css';const reducedMotionQuery = '(prefers-reduced-motion: reduce)';@@ -220,15 +220,17 @@ const ElementCard: React.FC<{</div></a><div aria-live="polite" className={styles.installAction}>- <InlineStudioButton+ <BlueButtonaria-label={`${installButtonLabel} β ${definition.displayName}`}- icon={null}+ fullWidth={false}loading={isInstalling}onClick={installElement}+ size="sm"+ style={{padding: '5px 8px'}}title="Install in the most recently focused Remotion Studio">{installButtonLabel}- </InlineStudioButton>+ </BlueButton></div></li>);diff --git a/packages/docs/src/components/Elements/InlineStudioButton.module.css b/packages/docs/src/components/Elements/InlineStudioButton.module.cssdeleted file mode 100644index ec3e045af3..0000000000--- a/packages/docs/src/components/Elements/InlineStudioButton.module.css+++ /dev/null@@ -1,63 +0,0 @@-.button {- position: relative;- z-index: 1;- display: inline-flex;- flex: 0 0 auto;- gap: 4px;- align-items: center;- justify-content: center;- min-width: 54px;- height: 30px;- margin: 0;- padding: 0 9px 0 7px;- border: 0;- border-radius: 7px;- background: var(--ifm-color-emphasis-100);- color: var(--ifm-color-emphasis-800);- cursor: pointer;- font: inherit;- font-size: 0.8125rem;- font-weight: 600;- line-height: 1;-}--.button:hover:not(:disabled) {- background: var(--ifm-color-emphasis-200);- color: var(--ifm-color-emphasis-800);-}--.button:disabled {- cursor: default;- opacity: 0.65;-}--.button:focus-visible {- outline: 2px solid var(--ifm-color-primary);- outline-offset: 2px;-}--.icon {- display: inline-grid;- width: 12px;- height: 16px;- flex: 0 0 auto;- place-items: center;- font-size: 1rem;- font-weight: 400;- line-height: 1rem;-}--.touchTarget {- position: absolute;- top: 50%;- left: 50%;- width: max(100%, 48px);- height: max(100%, 48px);- transform: translate(-50%, -50%);-}--@media (pointer: fine) {- .touchTarget {- display: none;- }-}diff --git a/packages/docs/src/components/Elements/InlineStudioButton.tsx b/packages/docs/src/components/Elements/InlineStudioButton.tsxdeleted file mode 100644index e42eb7de40..0000000000--- a/packages/docs/src/components/Elements/InlineStudioButton.tsx+++ /dev/null@@ -1,33 +0,0 @@-import React, {type ButtonHTMLAttributes, type ReactNode} from 'react';-import styles from './InlineStudioButton.module.css';--export const InlineStudioButton: React.FC<- ButtonHTMLAttributes<HTMLButtonElement> & {- readonly icon: ReactNode | null;- readonly loading: boolean;- }-> = ({children, disabled, icon, loading, ...props}) => {- return (- <button- {...props}- aria-busy={loading}- className={styles.button}- disabled={disabled || loading}- type="button"- >- {loading ? (- 'β¦'- ) : (- <>- {icon === null ? null : (- <span aria-hidden="true" className={styles.icon}>- {icon}- </span>- )}- {children}- </>- )}- <span aria-hidden="true" className={styles.touchTarget} />- </button>- );-};diff --git a/packages/docs/src/components/Elements/ThirdPartyElementLibraries.module.css b/packages/docs/src/components/Elements/ThirdPartyElementLibraries.module.cssindex 2832d2238c..d2a6d19c0b 100644--- a/packages/docs/src/components/Elements/ThirdPartyElementLibraries.module.css+++ b/packages/docs/src/components/Elements/ThirdPartyElementLibraries.module.css@@ -91,6 +91,11 @@outline-offset: -2px;}+.addAction {+ position: relative;+ z-index: 1;+}+.loadingStatus,.successStatus,.errorStatus {diff --git a/packages/docs/src/components/Elements/ThirdPartyElementLibraries.tsx b/packages/docs/src/components/Elements/ThirdPartyElementLibraries.tsxindex 3b8a9e092d..a769509fb9 100644--- a/packages/docs/src/components/Elements/ThirdPartyElementLibraries.tsx+++ b/packages/docs/src/components/Elements/ThirdPartyElementLibraries.tsx@@ -3,7 +3,7 @@ import {type AddElementLibraryToStudioErrorCode,} from '@remotion/studio-protocol';import React, {useCallback, useId, useState} from 'react';-import {InlineStudioButton} from './InlineStudioButton';+import {BlueButton} from '../../../components/layout/Button';import {thirdPartyElementLibraries,type ThirdPartyElementLibrary,@@ -109,16 +109,20 @@ const ThirdPartyElementLibraryItem: React.FC<{{library.displayName}</a></h3>- <InlineStudioButton+ <BlueButton+ aria-busy={isLoading}aria-describedby={addState.type === 'idle' ? undefined : statusId}aria-label={isLoading? `Adding ${library.displayName} to Studio`: `Add ${library.displayName} to Studio`}- icon="+"+ className={styles.addAction}+ fullWidth={false}loading={isLoading}onClick={addToStudio}+ size="sm"+ style={{padding: '5px 8px'}}title={isLoading? `Adding ${library.displayName} to Studio`@@ -126,7 +130,7 @@ const ThirdPartyElementLibraryItem: React.FC<{}>Add to Studio- </InlineStudioButton>+ </BlueButton></div>{status}</div>