lstrrs / ember-styled-components

Visual primitives for the component age. A simple port for Ember of styled-components 💅
MIT License
12 stars 0 forks source link

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

Open ariesshrimp opened 5 years ago

ariesshrimp commented 5 years ago

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 commented 4 years ago

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