🎥 Make videos programmatically with React
Match Wrap action styling to Browse Elements
Jonny Burger00cea5b94331
diff --git a/packages/studio/src/components/InspectorPanel/SequenceWrapAction.tsx b/packages/studio/src/components/InspectorPanel/SequenceWrapAction.tsxindex 0013b386b8..cdfa91f843 100644--- a/packages/studio/src/components/InspectorPanel/SequenceWrapAction.tsx+++ b/packages/studio/src/components/InspectorPanel/SequenceWrapAction.tsx@@ -4,7 +4,9 @@ import {isHtmlInCanvasSupported, useVideoConfig} from 'remotion';import {LIGHT_TEXT} from '../../helpers/colors';import type {SequenceNodePathInfo} from '../../helpers/get-timeline-sequence-sort-key';import type {TimelineTrackData} from '../../helpers/get-timeline-sequence-sort-key';+import {HOVERABLE_PAINT_COLOR} from '../../helpers/hoverable';import {CaretDown} from '../../icons/caret';+import {WrapIcon} from '../../icons/wrap';import {INSPECTOR_PANEL_HORIZONTAL_PADDING} from '../InspectorPanelLayout';import type {ComboboxValue} from '../NewComposition/ComboBox';import {showNotification} from '../Notifications/NotificationCenter';@@ -28,7 +30,37 @@ const segmentStyle: React.CSSProperties = {width: '100%',};-const labelStyle: React.CSSProperties = {flex: 1, textAlign: 'left'};+const iconStyle: React.CSSProperties = {height: 22, width: 22};++const iconContainerStyle: React.CSSProperties = {+ flexShrink: 0,+ height: 22,+ marginLeft: -2,+ marginRight: -2,+ width: 22,+};++const labelStyle: React.CSSProperties = {+ color: HOVERABLE_PAINT_COLOR,+ flex: 1,+ fontFamily: 'sans-serif',+ fontSize: 13,+ lineHeight: '18px',+ minWidth: 0,+ overflow: 'hidden',+ textAlign: 'left',+ textOverflow: 'ellipsis',+ userSelect: 'none',+ WebkitUserSelect: 'none',+ whiteSpace: 'nowrap',+};++const caretStyle: React.CSSProperties = {+ display: 'flex',+ flexShrink: 0,+ height: 12,+ width: 12,+};export const SequenceWrapAction: React.FC<{readonly nodePathInfo: SequenceNodePathInfo;@@ -133,10 +165,15 @@ export const SequenceWrapAction: React.FC<{idleColor: LIGHT_TEXT,leaveLeftSpace: false,onOpenChange: null,- renderContent: (color) => (+ renderContent: () => (<>+ <span style={iconContainerStyle}>+ <WrapIcon color={HOVERABLE_PAINT_COLOR} style={iconStyle} />+ </span><span style={labelStyle}>Wrap</span>- <CaretDown color={color} />+ <span style={caretStyle}>+ <CaretDown color={HOVERABLE_PAINT_COLOR} />+ </span></>),segmentId: 'wrap',diff --git a/packages/studio/src/helpers/hoverable.ts b/packages/studio/src/helpers/hoverable.tsindex 1e21b545a3..6d7539b193 100644--- a/packages/studio/src/helpers/hoverable.ts+++ b/packages/studio/src/helpers/hoverable.ts@@ -17,6 +17,9 @@ const BG_VARIABLE = '--remotion-studio-hoverable-bg';const HOVER_BG_VARIABLE = '--remotion-studio-hoverable-hover-bg';const COLOR_VARIABLE = '--remotion-studio-hoverable-color';const HOVER_COLOR_VARIABLE = '--remotion-studio-hoverable-hover-color';+const PAINT_COLOR_VARIABLE = '--remotion-studio-hoverable-paint-color';++export const HOVERABLE_PAINT_COLOR = `var(${PAINT_COLOR_VARIABLE})`;export const NO_HOVER_BACKGROUND_STYLE = {[HOVER_BG_VARIABLE]: TRANSPARENT,@@ -56,6 +59,7 @@ const reveal = `.${HOVER_GROUP_REVEAL_CLASS_NAME}.${HOVER_GROUP_REVEAL_CLASS_NAMexport const makeHoverableCSS = () => `${hoverable} {background-color: var(${BG_VARIABLE}, ${TRANSPARENT});+ ${PAINT_COLOR_VARIABLE}: var(${COLOR_VARIABLE}, inherit);}${hoverable},@@ -70,6 +74,7 @@ export const makeHoverableCSS = () => `@media (hover: hover) {${hoverable}:hover {background-color: var(${HOVER_BG_VARIABLE}, var(${BG_VARIABLE}, ${TRANSPARENT}));+ ${PAINT_COLOR_VARIABLE}: var(${HOVER_COLOR_VARIABLE}, var(${COLOR_VARIABLE}, inherit));}${hoverable}:hover,@@ -85,6 +90,10 @@ export const makeHoverableCSS = () => `color: var(${COLOR_VARIABLE}, inherit);}+ ${hoverable}:hover ${hoverable}:not(:hover) {+ ${PAINT_COLOR_VARIABLE}: var(${COLOR_VARIABLE}, inherit);+ }+${hoverGroup} ${reveal} {opacity: 0;width: 0;diff --git a/packages/studio/src/icons/wrap.tsx b/packages/studio/src/icons/wrap.tsxnew file mode 100644index 0000000000..ea2aa8a8ce--- /dev/null+++ b/packages/studio/src/icons/wrap.tsx@@ -0,0 +1,30 @@+import type {SVGProps} from 'react';++export const WrapIcon: React.FC<+ SVGProps<SVGSVGElement> & {readonly color: string}+> = ({color, ...props}) => {+ return (+ <svg {...props} xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">+ <rect+ fill="none"+ x="2.5"+ y="2.5"+ width="19"+ height="19"+ rx="2.5"+ stroke={color}+ strokeWidth="1.8"+ />+ <rect+ fill="none"+ x="6.5"+ y="6.5"+ width="11"+ height="11"+ rx="1.5"+ stroke={color}+ strokeWidth="1.8"+ />+ </svg>+ );+};