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

280 lines
5.2 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;
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;
z-index: 1;
[dir="rtl"] & {
left: ${userIndicatorsOffset};
right: auto;
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;
display: flex;
justify-content: center;
align-items: center;
2021-10-29 19:23:50 +08:00
[dir="rtl"] & {
left: auto;
right: ${userIndicatorsOffset};
}
}
`}
${({ 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;
display: flex;
justify-content: center;
align-items: center;
2021-10-29 19:23:50 +08:00
[dir="rtl"] & {
left: auto;
right: ${userIndicatorsOffset};
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;
display: flex;
justify-content: center;
align-items: center;
2021-10-29 19:23:50 +08:00
}
`}
${({ 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;
display: flex;
justify-content: center;
align-items: center;
2021-10-29 19:23:50 +08:00
}
`}
${({ 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;
display: flex;
justify-content: center;
align-items: center;
2021-10-29 19:23:50 +08:00
}
`}
${({ 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
};