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

wrong color on desktop #27

Closed
hans2103 opened this issue Sep 11, 2020 · 2 comments
Closed

wrong color on desktop #27

hans2103 opened this issue Sep 11, 2020 · 2 comments

Comments

@hans2103
Copy link

hans2103 commented Sep 11, 2020

trying to apply a change of color from breakpoint md using the following styling:

part of my components/Button.js

import React from "react";
import styled from "styled-components";
import breakpoint from "styled-components-breakpoint";

const StyledButtonAddRemove = styled(Button)`
  color: ${({ theme }) => theme.colors.type};
  background-color: ${({ theme }) => theme.colors.typeInverse};

  ${breakpoint("md")`
    color: ${({ theme }) => theme.colors.typeInverse};
    background-color: ${({ theme }) => theme.colors.type};
  `}
`;

part of my ./theme.js

const colors = {
  type: "hsl(0, 0%, 100%)",
  typeInverse: "hsl(0, 0%, 0%)"
};

After rendering I see the following in the my dev tools while inspecting desktop:

@media screen and (min-width: 48em)
.bDBudy {
    color: hsl(0,0%,0%)hsl(0,0%,100%);
}

while I was expecting to see:

@media screen and (min-width: 48em)
.bDBudy {
    color: hsl(0,0%,0%);
    background-color: hsl(0,0%,100%);
}

It does seem to work when I replace the reference to my them by hard coded colors:

import React from "react";
import styled from "styled-components";
import breakpoint from "styled-components-breakpoint";

const StyledButtonAddRemove = styled(Button)`
  color: ${({ theme }) => theme.colors.type};
  background-color: ${({ theme }) => theme.colors.typeInverse};

  ${breakpoint("md")`
    color: red;
    background-color: blue;
  `}
`;

this renders as

@media screen and (min-width: 48em)
.gzeeqj {
    color: red;
    background-color: blue;
}

ThemeProvider is added in App.js

I would like to be able to use the theme colors. How can I achieve this?

@profyt
Copy link

profyt commented Oct 2, 2020

its bug, #26

@hans2103
Copy link
Author

hans2103 commented Jan 6, 2023

when bug is solved, this issue will be solved too.... I guess.
therefor... closing this issue

@hans2103 hans2103 closed this as completed Jan 6, 2023
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