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

Question: is there any way to access Passed Props? #3

Open
ariesshrimp opened this issue Jul 25, 2019 · 1 comment
Open

Question: is there any way to access Passed Props? #3

ariesshrimp opened this issue Jul 25, 2019 · 1 comment

Comments

@ariesshrimp
Copy link

ariesshrimp commented Jul 25, 2019

The styled-components documentation describes ways to generate styles as a function from the arguments passed to the component by consumers. For example:

const Input = styled.input`
  color: ${props => props.inputColor || "palevioletred"};
`

how does this part of the styled-components API work in ember with this package?

that is, is there a way to write code that looks like this:

// ./app/components/styled-heading/component.js
import styled from 'ember-styled-components';

const StyledHeading = styled.h1`
  font-size: 2em;
  background: ${args => args.highContrast ? 'white' : 'gray'}
`
{-- ./app/templates/application.hbs --}
<StyledHeading @highContrast={{false}}>My background is gray</StyledHeading>
@HarshRohila
Copy link

@joefraley passed props works. The example you provided should work correctly. https://dev.to/shayanypn/using-styled-component-with-ember-js-2h71

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

No branches or pull requests

2 participants