bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/user-avatar/styles.js

274 lines
5.1 KiB
JavaScript
Raw Normal View History

2021-10-29 19:23:50 +08:00
import styled, { css, keyframes } from 'styled-components';
import {
userIndicatorsOffset,
mdPaddingY,
indicatorPadding,
} from '/imports/ui/stylesheets/styled-components/general';
import {
colorPrimary,
colorWhite,
userListBg,
colorSuccess,
colorDanger,
colorOffWhite,
} from '/imports/ui/stylesheets/styled-components/palette';
const Content = styled.div`
color: ${colorWhite};
top: 50%;
position: absolute;
text-align: center;
left: 0;
right: 0;
font-size: 110%;
text-transform: capitalize;
&,
& > * {
line-height: 0; // to keep centralized vertically
}
`;
const Image = styled.div`
display: flex;
height: 100%;
width: 100%;
justify-content: center;
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
2021-10-29 19:23:50 +08:00
`;
const Img = styled.img`
object-fit: cover;
overflow: hidden;
${({ moderator }) => moderator && `
border-radius: 3px;
`}
${({ moderator }) => !moderator && `
border-radius: 50%;
`}
`;
const pulse = keyframes`
0% {
opacity: 1;
transform: scale(1);
}
100% {
opacity: 0;
transform: scale(1.5);
}
`;
const Talking = styled.div`
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
border-radius: inherit;
${({ talking }) => talking && css`
background-color: currentColor;
`}
2021-10-29 19:23:50 +08:00
${({ talking, animations }) => talking && animations && css`
animation: ${pulse} 1s infinite ease-in;
`}
&::before {
${({ talking, animations }) => talking && !animations && `
content: '';
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
background-color: currentColor;
border-radius: inherit;
box-shadow: 0 0 0 4px currentColor;
opacity: .5;
`}
}
`;
const Avatar = styled.div`
position: relative;
height: 2.25rem;
width: 2.25rem;
2021-10-29 19:23:50 +08:00
border-radius: 50%;
text-align: center;
font-size: .85rem;
border: 2px solid transparent;
2022-09-29 02:32:37 +08:00
user-select: none;
2021-10-29 19:23:50 +08:00
${({ animations }) => animations && `
transition: .3s ease-in-out;
`}
&:after,
&:before {
content: "";
position: absolute;
width: 0;
height: 0;
padding-top: .5rem;
padding-right: ${({ isSafari }) => isSafari ? '.6rem' : '0'};
2021-10-29 19:23:50 +08:00
padding-left: 0;
padding-bottom: 0;
color: inherit;
top: auto;
left: auto;
bottom: ${userIndicatorsOffset};
right: ${userIndicatorsOffset};
border: 1.5px solid ${userListBg};
border-radius: 50%;
background-color: ${colorSuccess};
color: ${colorWhite};
opacity: 0;
font-family: 'bbb-icons';
font-size: .65rem;
line-height: 0;
text-align: center;
vertical-align: middle;
letter-spacing: -.65rem;
z-index: 1;
[dir="rtl"] & {
left: ${userIndicatorsOffset};
right: auto;
padding-right: .65rem;
padding-left: 0;
}
${({ animations }) => animations && `
transition: .3s ease-in-out;
`}
}
${({ moderator }) => moderator && `
border-radius: 5px;
`}
${({ presenter }) => presenter && `
&:before {
content: "\\00a0\\e90b\\00a0";
opacity: 1;
top: ${userIndicatorsOffset};
left: ${userIndicatorsOffset};
bottom: auto;
right: auto;
border-radius: 5px;
background-color: ${colorPrimary};
height: 1.2rem;
width: 1.2rem;
2021-10-29 19:23:50 +08:00
[dir="rtl"] & {
left: auto;
right: ${userIndicatorsOffset};
letter-spacing: -.33rem;
}
}
`}
${({ whiteboardAccess }) => whiteboardAccess && `
&:before {
content: "\\00a0\\e925\\00a0";
border-radius: 50% !important;
opacity: 1;
top: ${userIndicatorsOffset};
left: ${userIndicatorsOffset};
bottom: auto;
right: auto;
border-radius: 5px;
background-color: ${colorPrimary};
height: 1.2rem;
width: 1.2rem;
2021-10-29 19:23:50 +08:00
[dir="rtl"] & {
left: auto;
right: ${userIndicatorsOffset};
letter-spacing: -.33rem;
transform: scale(-1, 1);
2021-10-29 19:23:50 +08:00
}
}
`}
${({ voice }) => voice && `
2021-10-29 19:23:50 +08:00
&:after {
content: "\\00a0\\e931\\00a0";
background-color: ${colorSuccess};
top: 1.375rem;
left: 1.375rem;
right: auto;
[dir="rtl"] & {
left: auto;
right: 1.375rem;
}
2021-10-29 19:23:50 +08:00
opacity: 1;
width: 1.2rem;
height: 1.2rem;
}
`}
${({ muted }) => muted && `
2021-10-29 19:23:50 +08:00
&:after {
content: "\\00a0\\e932\\00a0";
background-color: ${colorDanger};
2021-10-29 19:23:50 +08:00
opacity: 1;
width: 1.2rem;
height: 1.2rem;
}
`}
${({ listenOnly }) => listenOnly && `
2021-10-29 19:23:50 +08:00
&:after {
content: "\\00a0\\e90c\\00a0";
2021-10-29 19:23:50 +08:00
opacity: 1;
width: 1.2rem;
height: 1.2rem;
}
`}
${({ noVoice }) => noVoice && `
&:after {
content: "";
background-color: ${colorOffWhite};
top: 1.375rem;
left: 1.375rem;
right: auto;
[dir="rtl"] & {
left: auto;
right: 1.375rem;
}
opacity: 1;
width: 1.2rem;
height: 1.2rem;
}
`}
2022-03-17 01:53:41 +08:00
`;
2021-10-29 19:23:50 +08:00
2022-03-17 01:53:41 +08:00
const Skeleton = styled.div`
& .react-loading-skeleton {
height: 2.25rem;
width: 2.25rem;
}
2021-10-29 19:23:50 +08:00
`;
export default {
Content,
Image,
Img,
Talking,
Avatar,
2022-03-17 01:53:41 +08:00
Skeleton,
2021-10-29 19:23:50 +08:00
};