menu
announcement

Spectrum is now read-only. Learn more about the decision in our official announcement.

Gatsby

Fast in every way that matters. Gatsby is a free and open source framework based on React that helps developers build blazing fast websites and apps.

Channels
Team

Theme-ui / import values from markdown

January 22, 2020 at 10:00pm

Theme-ui / import values from markdown

January 22, 2020 at 10:00pm
Hi,
I have built a theme using theme-ui and in the shadowed theme-ui object in the site I wanted to import some values from a markdown file.
Not quite sure how I would do this.
Initially tried to make the index.js shadowed file into a react functional component which grabbed the needed values via useStaticQuery and graphql but I'm coming up short.
Any ideas?

January 22, 2020 at 10:40pm
If its not possible to change the shadowed theme object into a functional component that grabs data from a markdown file and exports the theme object ... maybe the context that the gatsby-plugin-theme-ui creates can be updated in a page component that does the staticquery?

January 23, 2020 at 12:59pm
Think i've solved it
If I don't use the gatsby-plugin-theme-ui then I can import the <themeProvider> in my layout where I can import the theme and then check choose to update the theme object dependent on what is in a md file from a cms.
The plugin here has obscurred how this works so is less useful, but that might just be my ignorance into what it was doing.