Skip to content

Commit

Permalink
🐛 Add default color for Body
Browse files Browse the repository at this point in the history
  • Loading branch information
ulricden committed Feb 2, 2024
1 parent c5cf6ae commit 3731031
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/components/typography/Body.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';
import { StyleProp, Text, TextStyle } from 'react-native';
import type { TextProps } from 'react-native-paper';
import { useTheme } from '../../styles/themes';

export const toCamelCase = (str: string): string =>
str
Expand All @@ -19,6 +20,7 @@ export interface BodyProps extends TextProps<Text> {
export const Body = (props: BodyProps) => {
const { size, weight, children, style } = props;
const weightSuffix = toCamelCase(weight === undefined ? 'regular' : weight);
const theme = useTheme();

let bodyStyle: StyleProp<TextStyle> = style;
switch (size) {
Expand Down Expand Up @@ -54,6 +56,7 @@ export const Body = (props: BodyProps) => {
bodyStyle = {
...bodyStyle,
fontFamily: 'PublicSans-' + weightSuffix,
color: theme.sw.colors.neutral['800'],
};

return (
Expand Down

0 comments on commit 3731031

Please sign in to comment.