convert whiteboard annotations component

This commit is contained in:
Ramón Souza 2021-11-02 16:35:54 +00:00
parent e384cd81fe
commit f6f47bf25a
4 changed files with 27 additions and 18 deletions

View File

@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
import PollService from '/imports/ui/components/poll/service'; import PollService from '/imports/ui/components/poll/service';
import caseInsensitiveReducer from '/imports/utils/caseInsensitiveReducer'; import caseInsensitiveReducer from '/imports/utils/caseInsensitiveReducer';
import { injectIntl, defineMessages } from 'react-intl'; import { injectIntl, defineMessages } from 'react-intl';
import styles from './styles'; import Styled from './styles';
import { import {
getSwapLayout, getSwapLayout,
shouldEnableSwapLayout, shouldEnableSwapLayout,
@ -475,7 +475,7 @@ class PollDrawComponent extends Component {
strokeWidth={thickness} strokeWidth={thickness}
/> />
{extendedTextArray.map((line) => ( {extendedTextArray.map((line) => (
<text <Styled.OutlineText
x={line.keyColumn.xLeft} x={line.keyColumn.xLeft}
y={line.keyColumn.yLeft} y={line.keyColumn.yLeft}
dy={maxLineHeight / 2} dy={maxLineHeight / 2}
@ -484,10 +484,9 @@ class PollDrawComponent extends Component {
fontFamily="Arial" fontFamily="Arial"
fontSize={calcFontSize} fontSize={calcFontSize}
textAnchor={isRTL ? 'end' : 'start'} textAnchor={isRTL ? 'end' : 'start'}
className={styles.outline}
> >
{line.keyColumn.keyString} {line.keyColumn.keyString}
</text> </Styled.OutlineText>
))} ))}
{extendedTextArray.map((line) => ( {extendedTextArray.map((line) => (
<rect <rect
@ -510,15 +509,14 @@ class PollDrawComponent extends Component {
textAnchor={isRTL ? 'start' : 'end'} textAnchor={isRTL ? 'start' : 'end'}
> >
{extendedTextArray.map((line) => ( {extendedTextArray.map((line) => (
<tspan <Styled.OutlineTSpan
x={line.percentColumn.xRight} x={line.percentColumn.xRight}
y={line.percentColumn.yRight} y={line.percentColumn.yRight}
dy={maxLineHeight / 2} dy={maxLineHeight / 2}
key={`${line.key}_percent`} key={`${line.key}_percent`}
className={styles.outline}
> >
{line.percentColumn.percentString} {line.percentColumn.percentString}
</tspan> </Styled.OutlineTSpan>
))} ))}
</text> </text>
<text <text
@ -530,16 +528,15 @@ class PollDrawComponent extends Component {
textAnchor={isRTL ? 'end' : 'start'} textAnchor={isRTL ? 'end' : 'start'}
> >
{extendedTextArray.map((line) => ( {extendedTextArray.map((line) => (
<tspan <Styled.OutlineTSpan
x={line.barColumn.xNumVotes + (line.barColumn.barWidth / 2)} x={line.barColumn.xNumVotes + (line.barColumn.barWidth / 2)}
y={line.barColumn.yNumVotes + (line.barColumn.barHeight / 2)} y={line.barColumn.yNumVotes + (line.barColumn.barHeight / 2)}
dy={maxLineHeight / 2} dy={maxLineHeight / 2}
key={`${line.key}_numVotes`} key={`${line.key}_numVotes`}
fill={line.barColumn.color} fill={line.barColumn.color}
className={styles.outline}
> >
{line.barColumn.numVotes} {line.barColumn.numVotes}
</tspan> </Styled.OutlineTSpan>
))} ))}
</text> </text>
</g> </g>

View File

@ -0,0 +1,18 @@
import styled from 'styled-components';
import { pollAnnotationGray } from '/imports/ui/stylesheets/styled-components/palette';
const OutlineText = styled.text`
stroke: ${pollAnnotationGray};
stroke-width: .5;
`;
const OutlineTSpan = styled.tspan`
stroke: ${pollAnnotationGray};
stroke-width: .5;
`;
export default {
OutlineText,
OutlineTSpan,
};

View File

@ -1,8 +0,0 @@
:root {
--poll-annotation-gray: #333333;
}
.outline {
stroke: var(--poll-annotation-gray);
stroke-width: .5;
}

View File

@ -41,6 +41,7 @@ const systemMessageBorderColor = '#C5CDD4';
const systemMessageFontColor = colorGrayDark; const systemMessageFontColor = colorGrayDark;
const colorHeading = colorGrayDark; const colorHeading = colorGrayDark;
const palettePlaceholderText = '#787675'; const palettePlaceholderText = '#787675';
const pollAnnotationGray = '#333333';
export { export {
colorWhite, colorWhite,
@ -77,4 +78,5 @@ export {
systemMessageFontColor, systemMessageFontColor,
colorHeading, colorHeading,
palettePlaceholderText, palettePlaceholderText,
pollAnnotationGray,
}; };