Skip to content
This repository has been archived by the owner on Jun 24, 2022. It is now read-only.

React - Text component - fontSize not computed when variant prop is defined in styled-components' attrs method #102

Open
ofreyssinet-ledger opened this issue Nov 24, 2021 · 3 comments
Labels
bug Something isn't working react Stuff that only impact the react package

Comments

@ofreyssinet-ledger
Copy link
Collaborator

Hey fellow devs, I’ve just noticed a small bug while using the Text component on LLD, don’t know why I didn’t notice it earlier:

If we pass variant as a regular prop in rendering (e.g in a component that returns <Text variant="h1" />), the fontSize will be applied normally, but if we pass it as prop in a styled component’s attrs like so:

import {Text} from "@ledgerhq/react-ui"
const SomeText = styled(Text).attrs(() => ({variant: "h1"}))``;

the fontFamily and fontWeight are working properly it seems, but the fontSize is not computed at all (it isn’t just overriden or sth like that, i checked the inspector)

Anyone has a clue why? 🧐 I guess it has something to do with how our styled-system is setup but it’s a mystery to me

@ofreyssinet-ledger ofreyssinet-ledger added bug Something isn't working react Stuff that only impact the react package labels Nov 24, 2021
@jelbaz-ledger
Copy link
Contributor

jelbaz-ledger commented Dec 1, 2021

Pinging @nparigi-ledger since I think that he worked on it quite a bit

@rkoleci
Copy link

rkoleci commented Dec 4, 2021

assign this to me. I'd like to give it a try.

@elbywan
Copy link
Contributor

elbywan commented Dec 6, 2021

Hey @rkoleci,

You're more than welcome to make a PR if you'd like to contribute on this topic 👍 .

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working react Stuff that only impact the react package
Projects
None yet
Development

No branches or pull requests

4 participants