Skip to content

🎥 Make videos programmatically with React

info bubble

Jonny Burgerdac63603706a
diff --git a/packages/cli/src/editor/components/RenderModal/InfoBubble.tsx b/packages/cli/src/editor/components/RenderModal/InfoBubble.tsx
index c92e44b391..afd977769a 100644
--- a/packages/cli/src/editor/components/RenderModal/InfoBubble.tsx
+++ b/packages/cli/src/editor/components/RenderModal/InfoBubble.tsx
@@ -82,18 +82,25 @@ export const InfoBubble: React.FC<{
};
}, [refresh]);
- const portalStyle = useMemo((): React.CSSProperties | null => {
- if (!opened || !size) {
- return null;
+ const layout = useMemo(() => {
+ if (!size) {
+ return 'down';
}
const spaceToBottom = size.windowSize.height - (size.top + size.height);
const spaceToTop = size.top;
- const layout = spaceToTop > spaceToBottom ? 'bottom' : 'top';
+ const l = spaceToTop > spaceToBottom ? 'down' : 'up';
+ return l;
+ }, [size]);
+
+ const portalStyle = useMemo((): React.CSSProperties | null => {
+ if (!size || !opened) {
+ return null;
+ }
return {
- ...(layout === 'top'
+ ...(layout === 'up'
? {
position: 'fixed',
top: size.top + size.height,
@@ -104,7 +111,7 @@ export const InfoBubble: React.FC<{
}),
left: size.left,
};
- }, [opened, size]);
+ }, [layout, opened, size]);
const style = useMemo((): React.CSSProperties => {
return {
@@ -140,7 +147,7 @@ export const InfoBubble: React.FC<{
<div style={outerPortal} className="css-reset">
<HigherZIndex onOutsideClick={onHide} onEscape={onHide}>
<div style={portalStyle}>
- <InfoTooltip>{children}</InfoTooltip>
+ <InfoTooltip arrowDirection={layout}>{children}</InfoTooltip>
</div>
</HigherZIndex>
</div>,
diff --git a/packages/cli/src/editor/components/RenderModal/InfoTooltip.tsx b/packages/cli/src/editor/components/RenderModal/InfoTooltip.tsx
index cba9ade9fe..d166d76df9 100644
--- a/packages/cli/src/editor/components/RenderModal/InfoTooltip.tsx
+++ b/packages/cli/src/editor/components/RenderModal/InfoTooltip.tsx
@@ -1,43 +1,73 @@
-import React from 'react';
+import React, {useMemo} from 'react';
import {BACKGROUND, BORDER_COLOR} from '../../helpers/colors';
-import {SHADOW_TOWARDS_TOP} from '../Menu/styles';
-
-const container: React.CSSProperties = {
- padding: '10px 12px',
- // TODO: Depending on direction
- boxShadow: SHADOW_TOWARDS_TOP,
- background: BACKGROUND,
- color: 'white',
- border: '0.5px solid ' + BORDER_COLOR,
- maxHeight: 200,
- overflow: 'auto',
-};
+import {SHADOW_TOWARDS_BOTTOM, SHADOW_TOWARDS_TOP} from '../Menu/styles';
const arrow: React.CSSProperties = {
height: 7,
display: 'block',
overflow: 'visible',
- marginTop: -0.5,
marginLeft: 7,
};
+const arrowUp: React.CSSProperties = {
+ ...arrow,
+ transform: `translateY(1px)`,
+};
+
+const arrowDown: React.CSSProperties = {
+ ...arrow,
+ marginTop: -0.5,
+};
+
export const InfoTooltip: React.FC<{
children: React.ReactNode;
-}> = ({children}) => {
+ arrowDirection: 'up' | 'down';
+}> = ({children, arrowDirection}) => {
+ const container: React.CSSProperties = useMemo(() => {
+ return {
+ padding: '10px 12px',
+ // TODO: Depending on direction
+ boxShadow:
+ arrowDirection === 'down' ? SHADOW_TOWARDS_TOP : SHADOW_TOWARDS_BOTTOM,
+ background: BACKGROUND,
+ color: 'white',
+ border: '0.5px solid ' + BORDER_COLOR,
+ maxHeight: 200,
+ overflow: 'auto',
+ };
+ }, [arrowDirection]);
return (
- // TODO: Down arrow
// TODO: not scrolling with portal
- <>
+ <div
+ style={{
+ display: 'flex',
+ flexDirection: arrowDirection === 'up' ? 'column-reverse' : 'column',
+ alignItems: 'flex-start',
+ }}
+ >
<div style={container}>{children}</div>
- <svg viewBox="0 0 14 7" style={arrow}>
- <path
- d={`M 14 0 L 7 7 L 0 0`}
- fill={BACKGROUND}
- strokeLinecap="butt"
- stroke={BORDER_COLOR}
- strokeWidth={0.5}
- />
- </svg>
- </>
+ {arrowDirection === 'down' ? (
+ <svg viewBox="0 0 14 7" style={arrowDown}>
+ <path
+ d={`M 14 0 L 7 7 L 0 0`}
+ fill={BACKGROUND}
+ strokeLinecap="butt"
+ stroke={BORDER_COLOR}
+ strokeWidth={0.5}
+ />
+ </svg>
+ ) : null}
+ {arrowDirection === 'up' ? (
+ <svg viewBox="0 0 14 7" style={arrowUp}>
+ <path
+ d={`M 0 7 L 7 0 L 14 7`}
+ fill={BACKGROUND}
+ strokeLinecap="butt"
+ stroke={BORDER_COLOR}
+ strokeWidth={0.5}
+ />
+ </svg>
+ ) : null}
+ </div>
);
};
diff --git a/packages/renderer/src/options/jpeg-quality.tsx b/packages/renderer/src/options/jpeg-quality.tsx
index 6f2fcca457..8b49d53824 100644
--- a/packages/renderer/src/options/jpeg-quality.tsx
+++ b/packages/renderer/src/options/jpeg-quality.tsx
@@ -5,8 +5,9 @@ export const jpegQualityOption: RemotionOption = {
cliFlag: '--quality',
description: (
<>
- Sets the quality of the generate JPEG images. Must be an integer between 0
- and 100. Default is to leave it up to the browser, current default is 80.
+ Sets the quality of the generated JPEG images. Must be an integer between
+ 0 and 100. Default is to leave it up to the browser, current default is
+ 80.
</>
),
ssrName: 'quality',