Skip to content

🎥 Make videos programmatically with React

1.1 KB
Raw Blame
import {useCallback} from 'react';
import {CURRENT_COLOR} from '../../helpers/colors';
import {ActionTooltip} from '../ActionTooltip';
import type {RenderInlineAction} from '../InlineAction';
import {InlineAction} from '../InlineAction';

const clearIcon: React.CSSProperties = {
	height: 14,
	color: CURRENT_COLOR,
};

export const InlineRemoveButton: React.FC<{
	onClick: () => void;
}> = ({onClick}) => {
	const renderAction: RenderInlineAction = useCallback((color) => {
		return (
			<svg
				xmlns="http://www.w3.org/2000/svg"
				viewBox="0 0 320 512"
				style={clearIcon}
			>
				<path
					d="M310.6 150.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L160 210.7 54.6 105.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L114.7 256 9.4 361.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L160 301.3 265.4 406.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L205.3 256 310.6 150.6z"
					fill={color}
				/>
			</svg>
		);
	}, []);

	return (
		<ActionTooltip label="Remove" shortcut={null} delay={800} dismissOnClick>
			<InlineAction
				renderAction={renderAction}
				onClick={onClick}
				variant={null}
				aria-label="Remove"
			/>
		</ActionTooltip>
	);
};