Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Label - add testID and all body props #101

Merged
merged 1 commit into from
Oct 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions src/components/label/Label.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import { StyleSheet, View, ViewStyle } from 'react-native';
import { useTheme } from '../../styles/themes';

import { Body } from '../typography/Body';
import { Body, BodyProps } from '../typography/Body';

type LabelType = 'outlined' | 'filled' | 'soft';
type LabelColor =
Expand All @@ -14,14 +14,17 @@ type LabelColor =
| 'primary'
| 'neutral';

export interface Props {
type OptionnalBodyPropsWithoutSizeAndWeight = Partial<Omit<Omit<BodyProps, 'size'>, 'weight'>>;

export interface Props extends OptionnalBodyPropsWithoutSizeAndWeight {
style?: ViewStyle;
text: string;
type: LabelType;
labelColor?: LabelColor;
}

export const Label = ({ style, text, type, labelColor = 'neutral' }: Props) => {
export const Label = (props: Props) => {
const { style, text, type, labelColor = 'neutral' } = props;
const theme = useTheme();

const transparencyValue = theme.sw.transparency[16];
Expand Down Expand Up @@ -158,7 +161,7 @@ export const Label = ({ style, text, type, labelColor = 'neutral' }: Props) => {
});
return (
<View style={styles.container}>
<Body style={styles.text} size="B1" weight="bold">
<Body {...props} style={styles.text} size="B1" weight="bold">
valentinmagrez marked this conversation as resolved.
Show resolved Hide resolved
{text}
</Body>
</View>
Expand Down
Loading