@botonic/react
Version:
Build Chatbots using React
25 lines • 1.03 kB
JavaScript
import { jsx as _jsx } from "react/jsx-runtime";
import { INPUT, isBrowser } from '@botonic/core';
import styled from 'styled-components';
import { COLORS, ROLES } from '../constants';
import { staticAsset } from '../util/environment';
import { Message } from './message';
const StyledVideo = styled.video `
background-color: ${COLORS.SOLID_BLACK_ALPHA_0_5};
border-radius: 8px;
max-height: 180px;
max-width: 300px;
margin: 10px;
`;
const serialize = (videoProps) => {
return { video: videoProps.src };
};
export const Video = (props) => {
props = Object.assign(Object.assign({}, props), { src: staticAsset(props.src) });
let content = props.children;
if (isBrowser())
content = (_jsx(StyledVideo, Object.assign({ controls: true }, { children: _jsx("source", { src: props.src }) })));
return (_jsx(Message, Object.assign({ role: ROLES.VIDEO_MESSAGE, json: serialize(props) }, props, { type: INPUT.VIDEO }, { children: content })));
};
Video.serialize = serialize;
//# sourceMappingURL=video.js.map