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

feat(universal): add single text component w/context to replace other children text components #23

Merged
merged 1 commit into from
Jan 23, 2024

Conversation

mrzachnugent
Copy link
Owner

@mrzachnugent mrzachnugent commented Jan 23, 2024

This will remove children text components like <ButtonText />. It will use a <Text /> component from typography.

The Text component has a context that any parent can provide a className value for the text component. While using the cn utility function, undefined values from the context are ignored and the closest parent wins specificity.

Example:

import { Text } from '~/components/universal-ui/typography';

const Parent = (props) => <TextClassContext.Provider value="text-blue-500"><View {...props} /> </ TextClassContext.Provider>

const Component = () => <Parent><Text>Content</ Text></ Parent>

The "Content" text in the Text component will be blue.

@mrzachnugent
Copy link
Owner Author

Suggestion from Discussions: #21

@trentcharlie
Copy link
Contributor

I think this is looking great. Pretty much matches the implementation I was working on.

@mrzachnugent
Copy link
Owner Author

mrzachnugent commented Jan 23, 2024

I think this is looking great. Pretty much matches the implementation I was working on.

@trentcharlie
Sorry, I didn't understand that you were working on the implementation. I thought you would share more details before working on it.

@mrzachnugent mrzachnugent merged commit cfec919 into main Jan 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants