diff --git a/src/app/components/message/content/PollContent.tsx b/src/app/components/message/content/PollContent.tsx index 625e7e1e3..643e3f5ba 100644 --- a/src/app/components/message/content/PollContent.tsx +++ b/src/app/components/message/content/PollContent.tsx @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ import React, { useCallback, useEffect, useState } from 'react'; -import { Box, Text } from 'folds'; +import { Box, color, config, Text, toRem } from 'folds'; import { RelationsEvent } from 'matrix-js-sdk/lib/models/relations'; import { RoomEvent } from 'matrix-js-sdk'; import { useMatrixClient } from '../../../hooks/useMatrixClient'; @@ -175,7 +175,7 @@ export function PollContent({ if (!poll) { return ( - + Poll (unreadable format) ); @@ -244,21 +244,20 @@ export function PollContent({ gap="200" style={{ maxWidth: '340px', paddingTop: '2px', paddingBottom: '4px' }} > - {`◉ Poll · ${isMultiple ? 'Multiple choice' : 'Single choice'}`} - + {questionText} @@ -280,18 +279,19 @@ export function PollContent({ data-selected={selected} onClick={canVote ? () => handleVote(id) : undefined} style={{ - padding: '7px 12px', - borderRadius: '8px', - background: selected ? 'var(--accent-cyan-dim)' : 'rgba(255,255,255,0.04)', - border: `1.5px solid ${selected ? 'var(--accent-cyan)' : 'var(--border-color)'}`, - fontSize: '0.88rem', + padding: `${config.space.S200} ${config.space.S300}`, + borderRadius: config.radii.R300, + background: selected ? color.Primary.Container : color.SurfaceVariant.Container, + border: `${config.borderWidth.B300} solid ${ + selected ? color.Primary.Main : color.SurfaceVariant.ContainerLine + }`, lineHeight: 1.4, textAlign: 'left', cursor: canVote ? 'pointer' : 'default', color: 'inherit', display: 'flex', flexDirection: 'column', - gap: '4px', + gap: config.space.S100, width: '100%', position: 'relative', overflow: 'hidden', @@ -306,58 +306,59 @@ export function PollContent({ inset: 0, right: 'auto', width: `${pct}%`, - background: selected ? 'var(--accent-cyan-dim)' : 'rgba(255,255,255,0.03)', + background: selected + ? color.Primary.ContainerActive + : color.SurfaceVariant.ContainerActive, pointerEvents: 'none', transition: 'width 0.3s ease', }} /> )} - {isMultiple && ( - - {selected ? '✓' : ''} - - )} - {!isMultiple && ( - - )} - {text} + + {selected && isMultiple ? ( + + ✓ + + ) : null} + + + {text} + {total > 0 && ( - {pct}% + + {pct}% + )} ); })} - + {total > 0 ? `${total} vote${total === 1 ? '' : 's'} · ` : ''} {canVote