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

Pass staticMediaQuery to ScrollyCoding via props #390

Open
jgarrow opened this issue Jun 21, 2023 · 1 comment
Open

Pass staticMediaQuery to ScrollyCoding via props #390

jgarrow opened this issue Jun 21, 2023 · 1 comment

Comments

@jgarrow
Copy link

jgarrow commented Jun 21, 2023

I'm working on a docs site that has multiple different page layouts. Depending on the page, I want to be able to override the codeConfig options on the component level. Specifically, I'm wanting to change the value of staticMediaQuery for the Scrollycoding component depending on which page layout is being used. However, passing a codeConfig prop appears to always be overridden by the config values at the plugin configuration level.

Example expected implementation

Neither of these attempts seem to have any effect.

<CH.ScrollyCoding codeConfig={{staticMediaQuery: "not screen (max-width: 960px)"}}>

OR

<CH.ScrollyCoding staticMediaQuery="not screen (max-width: 960px)" >

Example repo

I'm running into this issue both in the site I'm working on as well as in this minimal reproducible example:

I've added a staticMediaQuery both to the next.config.js and a differing media query in the CH.Scrollycoding component's props in the scrollycoding.mdx file.

StackBlitz link

@pomber
Copy link
Contributor

pomber commented Jun 21, 2023

Yes, that's not implemented right now. I'll try to make the second option work soon. It will be consistent with other settings like <CH.ScrollyCoding lineNumbers={true}>

@pomber pomber changed the title Pass codeConfig to ScrollyCoding via props Pass staticMediaQuery to ScrollyCoding via props Jun 21, 2023
@pomber pomber changed the title Pass staticMediaQuery to ScrollyCoding via props Pass staticMediaQuery to ScrollyCoding via props Jun 21, 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