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

Interpolations with a prefix/suffix that are undefined result in the prefix/suffix being added to the inline style #346

Closed
itsdouges opened this issue Nov 5, 2020 · 0 comments · Fixed by #423
Labels
bug 🐛 Something isn't working

Comments

@itsdouges
Copy link
Collaborator

itsdouges commented Nov 5, 2020

export const HorizontalStack = styled.div`
  margin-top: ${(props) => props.spacing}rem;
`;

Results in:

--_1g0t409: rem;

Instead it should just not be defined.

This could potentially be fixed in conjunction with #333


We can introduce another util that will handle this logic. Behaviour required:

  1. Handle adding suffix/prefix only if the variable is defined
  2. If the variable is undefined return an empty variable
function interpolation(variable?: string | number, suffix?: string, prefix?: string): string;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant