signal-desktop/ts/components/CallBackgroundBlur.tsx

43 lines
917 B
TypeScript
Raw Normal View History

2021-02-19 17:50:32 +00:00
// Copyright 2020-2021 Signal Messenger, LLC
2020-10-30 20:34:04 +00:00
// SPDX-License-Identifier: AGPL-3.0-only
2020-10-08 01:25:33 +00:00
import React from 'react';
import classNames from 'classnames';
import type { AvatarColorType } from '../types/Colors';
2020-10-08 01:25:33 +00:00
export type PropsType = {
avatarPath?: string;
children?: React.ReactNode;
className?: string;
2021-05-28 16:15:17 +00:00
color?: AvatarColorType;
2020-10-08 01:25:33 +00:00
};
export const CallBackgroundBlur = ({
avatarPath,
children,
className,
2020-10-08 01:25:33 +00:00
color,
}: PropsType): JSX.Element => {
return (
<div
className={classNames(
'module-calling__background',
{
[`module-background-color__${color || 'default'}`]: !avatarPath,
},
className
)}
>
{avatarPath && (
<div
className="module-calling__background--blur"
style={{
2021-02-19 17:50:32 +00:00
backgroundImage: `url('${encodeURI(avatarPath)}')`,
}}
/>
)}
2020-10-08 01:25:33 +00:00
{children}
</div>
2020-10-08 01:25:33 +00:00
);
};