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

chore: Export components from docz-theme-default #615

Closed
wants to merge 8 commits into from
Closed

chore: Export components from docz-theme-default #615

wants to merge 8 commits into from

Conversation

huchenme
Copy link

@huchenme huchenme commented Feb 1, 2019

Description

Export components from docz-theme-default so it will be possible to make a custom component with dynamic markdown content

I believe currently it is not possible to do something like this

# Hello {firstName} {lastName}

But with this PR you could achieve

import {components} from 'docz-theme-default'

<components.H1>Hello {firstName} {lastName}</components.H1>

and it will also possible to include markdown headers in a custom component and serve as some kind of layout component

@swyxio
Copy link
Contributor

swyxio commented Feb 1, 2019

looks fine. related issue #612 (comment)

paging @pedronauck as this needs to be documented if accepted

@huchenme
Copy link
Author

@pedronauck Do you expect me to add documentation for this change?

@camden
Copy link

camden commented Feb 20, 2019

I'd love to see this merged so I can start using this feature.
Can we ship this first so that developers see value here, then document it after the fact?

@rupification
Copy link

same here. I wanted to make the same change. ship please...this makes it easier to pull in default theme components like render pre for <Playground>

@rupification
Copy link

Bump

@mikkelking
Copy link

Yes, ship please!

@msokk
Copy link

msokk commented Mar 18, 2019

This would be great, I want to override the component for different layout and sidebar styling, but keep everything in the content the same.

@rupification
Copy link

is there anyone besides @pedronauck who can manage pull requests? This is a great project 👍 👍 and hopefully things get moving...

@@ -67,4 +67,6 @@ const enhance = theme(config, ({ mode, codemirrorTheme, ...config }) => ({
},
}))

export {components}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be also nice to export enhance here, because many docz components use the context with settings, created there. maybe export config and modes would be useful too

Copy link
Author

@huchenme huchenme Mar 21, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, could you explain what you mean in code, please?

Is it to wrap the components in ThemeConfig, something like this?

const H1 = 
<ThemeConfig>
    {config => (
      <ThemeProvider
        theme={prev => ({
          ...prev,
          docz: config.themeConfig,
        })}
      >
  <components.H1 {...props} />
</ThemeConfig>

export enhance(H1)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, for example. at first, it's important for the main Theme component, like

import {ThemeConfig, DocPreview} from 'docz';
import {components, enhance} from 'docz-theme-default';

const Theme = () => (
    <ThemeConfig>
        {config => (
            <ThemeProvider
                theme={prev => ({
                    ...prev,
                    docz: config.themeConfig,
                })}
            >
                <DocPreview
                    components={{
                        page: Page,
                        render: components.render,
                        inlineCode: components.inlineCode,
                        loading: components.loading,
                        table: components.table,
                        pre: components.pre,
                        tooltip: components.tooltip,
                        ...customComponents,
                    }}
                />
            </ThemeProvider>
        )}
    </ThemeConfig>
);

export default enhance(Theme);

@huchenme
Copy link
Author

I guess @pedronauck have already pushed something into the code, closing this PR.

I will suggest maintainers to actively look at new PRs and let people know that it is something they are working on at the moment. This PR has been opened since Feb 1 and until today there is still no message from maintainer that this PR should be closed.

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 this pull request may close these issues.

8 participants