-
-
Notifications
You must be signed in to change notification settings - Fork 119
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
Using css`` and theme #483
Comments
Hey @xrofa, Indeed, that is not supported at the moment. The logic was that import { css } from "goober";
const cssWithTheme = css.bind({
// `p` here is the `props` key passed to the core logic
p: {
theme: {
radius: "16px"
}
}
});
const BtnClassName = cssWithTheme`
border-radius: ${({ theme }) => theme.radius};
`; Would this be something that could be of help? |
Hey @cristianbote ! Another question I have, are we able to use the css`` just like in styled-components?
|
Not exactly. import { styled, css } from 'goober'
// Switch to a regular function that returns an object
const complexMixin = props => ({
color: props.whiteColor ? 'white' : 'black';
});
// Switch to an array based parameters so you could nest multiple styles
const StyledComp = styled.div([
/* This is an example of a nested interpolation */
props => props.complex ? complexMixin(props) : { color: 'blue'}
]) These changes in essence do not change the output but they do change in how they interact and depend on each other. |
Is there any way to condition the property itself inside a styled() string? |
Hello!
With the
styled
method, we can use the theme we define, so we can have something like this:Is there any way of doing exactly the same but with the css method?
Something like this:
I've tried different ways, but I don't think its supported right now, am I right?
Thanks!
The text was updated successfully, but these errors were encountered: