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

Theming styles working inconsistently between markdown / html / components #265

Closed
amberleyromo opened this issue Feb 27, 2019 · 2 comments · Fixed by #270
Closed

Theming styles working inconsistently between markdown / html / components #265

amberleyromo opened this issue Feb 27, 2019 · 2 comments · Fixed by #270

Comments

@amberleyromo
Copy link

Hi there!

Wondering what I could be doing wrong here. Following the docs to include the <Appear> component, for list items.

When using a markdown unordered list, the theming styles apply as expected:

- Item one
- Item two
- Item three

screen shot 2019-02-27 at 11 13 21 am

When converting it to use <Appear>, the styles don't take effect:

<ul>
  <Appear>
    <li>Item one</li>
    <li>Item two</li>
    <li>Item three</li>
  </Appear>
</ul>

screen shot 2019-02-27 at 11 14 21 am

@jxnblk
Copy link
Owner

jxnblk commented Feb 28, 2019

You're not doing anything wrong at all! 😬 Although the current implementation isn't ideal, the theming only applies to MDX components at the moment, which means only elements generated from markdown will pick up those styles. And with the way MDX itself works, you can't nest markdown inside of a React component like Appear.

With the current version, the best way I know of styling both markdown lists and JSX elements the same way would be to add a global style for <ul>. I think adding a custom Provider would be the way to go, where you could add a styled-component that targets child <ul>

Maybe something like:

const Root = styled.div({
  '& ul': {
    ...listStyles
  }
})

@jxnblk jxnblk mentioned this issue Mar 10, 2019
Merged
12 tasks
@jxnblk
Copy link
Owner

jxnblk commented Mar 10, 2019

This will still be an issue, but just merged v2, which should resolve this issue. You can install the beta with npm i mdx-deck@next if you want to give it a shot

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

Successfully merging a pull request may close this issue.

2 participants