2021-11-03 00:25:39 +08:00
|
|
|
import styled from 'styled-components';
|
|
|
|
import {
|
|
|
|
borderSize,
|
|
|
|
borderRadius,
|
|
|
|
talkerBorderRadius,
|
|
|
|
talkerPaddingXsm,
|
|
|
|
talkerPaddingLg,
|
|
|
|
talkerMaxWidth,
|
|
|
|
talkerMarginSm,
|
|
|
|
spokeOpacity,
|
|
|
|
talkerPaddingXl,
|
|
|
|
} from '/imports/ui/stylesheets/styled-components/general';
|
|
|
|
import {
|
|
|
|
colorWhite,
|
|
|
|
colorSuccess,
|
|
|
|
colorDanger,
|
2022-04-14 21:59:54 +08:00
|
|
|
btnMutedColor,
|
2021-11-03 00:25:39 +08:00
|
|
|
} from '/imports/ui/stylesheets/styled-components/palette';
|
|
|
|
import {
|
|
|
|
fontSizeBase,
|
|
|
|
talkerFontWeight,
|
|
|
|
fontSizeXS,
|
|
|
|
fontSizeSmaller,
|
2022-04-14 21:59:54 +08:00
|
|
|
fontSizeSmall,
|
2021-11-03 00:25:39 +08:00
|
|
|
} from '/imports/ui/stylesheets/styled-components/typography';
|
2022-03-15 21:11:20 +08:00
|
|
|
import { phoneLandscape } from '/imports/ui/stylesheets/styled-components/breakpoints';
|
2022-02-15 04:20:50 +08:00
|
|
|
import Button from '/imports/ui/components/common/button/component';
|
2022-04-14 21:59:54 +08:00
|
|
|
import Icon from '/imports/ui/components/common/icon/component';
|
2021-11-03 00:25:39 +08:00
|
|
|
|
|
|
|
const TalkingIndicatorButton = styled(Button)`
|
|
|
|
display: flex;
|
|
|
|
flex-direction: row;
|
|
|
|
|
|
|
|
outline: transparent;
|
|
|
|
outline-style: dotted;
|
|
|
|
outline-width: ${borderSize};
|
|
|
|
|
|
|
|
flex: 0 0 auto;
|
|
|
|
color: ${colorWhite};
|
|
|
|
font-weight: ${talkerFontWeight};
|
|
|
|
border-radius: ${talkerBorderRadius} ${talkerBorderRadius};
|
|
|
|
font-size: ${fontSizeBase};
|
|
|
|
padding: ${talkerPaddingXsm} ${talkerPaddingLg} ${talkerPaddingXsm} ${talkerPaddingLg};
|
|
|
|
box-shadow: none !important;
|
|
|
|
|
|
|
|
@media ${phoneLandscape} {
|
|
|
|
height: 1rem;
|
|
|
|
}
|
2022-06-30 01:15:42 +08:00
|
|
|
|
2021-11-03 00:25:39 +08:00
|
|
|
i,
|
|
|
|
span {
|
|
|
|
position: relative;
|
|
|
|
}
|
|
|
|
|
|
|
|
span {
|
|
|
|
overflow: hidden;
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
white-space: nowrap;
|
|
|
|
margin: 0 0 0 0 !important;
|
|
|
|
max-width: ${talkerMaxWidth};
|
|
|
|
|
|
|
|
@media ${phoneLandscape} {
|
|
|
|
font-size: ${fontSizeXS};
|
|
|
|
}
|
|
|
|
|
|
|
|
[dir="rtl"] & {
|
|
|
|
margin-left: ${talkerMarginSm};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
i {
|
|
|
|
font-size: ${fontSizeSmaller};
|
|
|
|
width: 1rem;
|
|
|
|
height: 1rem;
|
|
|
|
line-height: 1rem;
|
|
|
|
background-color: ${colorSuccess};
|
|
|
|
border-radius: 50%;
|
|
|
|
position: relative;
|
|
|
|
right: ${talkerMarginSm};
|
|
|
|
|
|
|
|
@media ${phoneLandscape} {
|
|
|
|
height: ${talkerMarginSm};
|
|
|
|
width: ${talkerMarginSm};
|
|
|
|
font-size: ${fontSizeXS};
|
|
|
|
}
|
|
|
|
|
|
|
|
[dir="rtl"] & {
|
|
|
|
right: calc(${talkerMarginSm} * -1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
span:hover {
|
|
|
|
opacity: 1;
|
|
|
|
}
|
|
|
|
|
2022-06-30 01:15:42 +08:00
|
|
|
${({ $spoke }) => $spoke && `
|
2021-11-03 00:25:39 +08:00
|
|
|
opacity: ${spokeOpacity};
|
|
|
|
|
|
|
|
[dir="rtl"] & {
|
|
|
|
padding-right: ${talkerPaddingLg}
|
|
|
|
}
|
|
|
|
`}
|
|
|
|
|
2022-06-30 01:15:42 +08:00
|
|
|
${({ $muted }) => $muted && `
|
2021-11-03 00:25:39 +08:00
|
|
|
cursor: default;
|
2022-06-30 01:15:42 +08:00
|
|
|
|
2021-11-03 00:25:39 +08:00
|
|
|
i {
|
|
|
|
background-color: ${colorDanger};
|
|
|
|
}
|
|
|
|
`}
|
|
|
|
|
2022-06-30 01:15:42 +08:00
|
|
|
${({ $isViewer }) => $isViewer && `
|
2021-11-03 00:25:39 +08:00
|
|
|
cursor: default;
|
|
|
|
`}
|
|
|
|
`;
|
|
|
|
|
2022-04-14 21:59:54 +08:00
|
|
|
const CCIcon = styled(Icon)`
|
|
|
|
align-self: center;
|
|
|
|
color: ${colorWhite};
|
|
|
|
margin: 0 ${borderRadius};
|
|
|
|
font-size: calc(${fontSizeSmall} * .85);
|
|
|
|
opacity: ${({ muted, talking }) => ((muted || !talking) && `${spokeOpacity};`)
|
|
|
|
|| '1;'};
|
|
|
|
`;
|
|
|
|
|
|
|
|
const TalkingIndicatorWrapper = styled.div`
|
|
|
|
border-radius: ${talkerBorderRadius} ${talkerBorderRadius};
|
|
|
|
display: flex;
|
|
|
|
margin: 0 ${borderRadius};
|
|
|
|
opacity: ${({ muted, talking }) => ((muted || !talking) && `${spokeOpacity};`)
|
|
|
|
|| '1;'};
|
|
|
|
background: ${({ muted, talking }) => ((muted || !talking) && `${btnMutedColor};`)
|
|
|
|
|| `${colorSuccess}`}
|
|
|
|
`;
|
|
|
|
|
2021-11-03 00:25:39 +08:00
|
|
|
const Hidden = styled.div`
|
|
|
|
display: none;
|
|
|
|
`;
|
|
|
|
|
|
|
|
const IsTalkingWrapper = styled.div`
|
|
|
|
display: flex;
|
|
|
|
flex-direction: row;
|
|
|
|
position: relative;
|
|
|
|
margin-top: ${talkerMarginSm};
|
|
|
|
overflow: hidden;
|
|
|
|
`;
|
|
|
|
|
|
|
|
const Speaking = styled.div`
|
|
|
|
display: flex;
|
|
|
|
flex-direction: row;
|
|
|
|
flex-wrap: nowrap;
|
|
|
|
overflow-x: auto;
|
|
|
|
overflow-y: hidden;
|
|
|
|
max-height: ${talkerPaddingXl};
|
|
|
|
scrollbar-width: 0; // firefox
|
|
|
|
scrollbar-color: transparent;
|
|
|
|
|
|
|
|
&::-webkit-scrollbar {
|
|
|
|
width: 0px;
|
|
|
|
height: 0px;
|
|
|
|
background: transparent;
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
|
|
|
export default {
|
|
|
|
TalkingIndicatorButton,
|
2022-04-14 21:59:54 +08:00
|
|
|
TalkingIndicatorWrapper,
|
|
|
|
CCIcon,
|
2021-11-03 00:25:39 +08:00
|
|
|
Hidden,
|
|
|
|
IsTalkingWrapper,
|
|
|
|
Speaking,
|
|
|
|
};
|