diff options
| author | Oliver <oliver@mohlin.dev> | 2025-06-15 06:50:19 +0200 |
|---|---|---|
| committer | Oskar <oskar@mullvad.net> | 2025-06-30 11:05:27 +0200 |
| commit | e6fc6be837d241a7d7f1083c38bd582163ac3501 (patch) | |
| tree | 959d68b648c3e5e255e97d0ae5d753f22ffadc0a | |
| parent | f1ae892a9edbfb8ecc3a84f21332082dac113ea3 (diff) | |
| download | mullvadvpn-e6fc6be837d241a7d7f1083c38bd582163ac3501.tar.xz mullvadvpn-e6fc6be837d241a7d7f1083c38bd582163ac3501.zip | |
Add `text-align` prop to Text component
| -rw-r--r-- | desktop/packages/mullvad-vpn/src/renderer/lib/components/typography/Text.tsx | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/desktop/packages/mullvad-vpn/src/renderer/lib/components/typography/Text.tsx b/desktop/packages/mullvad-vpn/src/renderer/lib/components/typography/Text.tsx index dff1a9dc08..aa4b0f1fca 100644 --- a/desktop/packages/mullvad-vpn/src/renderer/lib/components/typography/Text.tsx +++ b/desktop/packages/mullvad-vpn/src/renderer/lib/components/typography/Text.tsx @@ -7,18 +7,20 @@ import { PolymorphicProps, TransientProps } from '../../types'; type TextBaseProps = { variant?: Typography; color?: Colors; + textAlign?: React.CSSProperties['textAlign']; }; export type TextProps<T extends React.ElementType = 'span'> = PolymorphicProps<T, TextBaseProps>; const StyledText = styled.span<TransientProps<TextBaseProps>>( - ({ $variant = 'bodySmall', $color = 'white' }) => { + ({ $variant = 'bodySmall', $color = 'white', $textAlign }) => { const { fontFamily, fontSize, fontWeight, lineHeight } = typography[$variant]; const color = colors[$color]; return ` --color: ${color}; color: var(--color); + text-align: ${$textAlign || undefined}; font-family: ${fontFamily}; font-size: ${fontSize}; font-weight: ${fontWeight}; @@ -30,9 +32,10 @@ const StyledText = styled.span<TransientProps<TextBaseProps>>( export const Text = <T extends React.ElementType = 'span'>({ variant, color, + textAlign, ...props }: TextProps<T>) => { - return <StyledText $variant={variant} $color={color} {...props} />; + return <StyledText $variant={variant} $color={color} $textAlign={textAlign} {...props} />; }; Text.displayName = 'Text'; |
