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

[Feature]: expose components from @rspress/theme-default #1569

Closed
liuwenzhuang opened this issue Nov 12, 2024 · 3 comments
Closed

[Feature]: expose components from @rspress/theme-default #1569

liuwenzhuang opened this issue Nov 12, 2024 · 3 comments

Comments

@liuwenzhuang
Copy link
Contributor

What problem does this feature solve?

I want to extend default theme, like add navmenu components. but I couldn't use components from @rspress/theme-default. If use self custom component, the compatibility with the original style will be difficult to guarantee.

What does the proposed API look like?

import { SomeComponent } from 'rspress/default'

@Timeless0911
Copy link
Collaborator

You can read https://rspress.dev/guide/advanced/custom-theme#3-custom-home-page-and-404-page

import Theme from 'rspress/theme';
import { Layout as BaseLayout } from 'rspress/theme';
import { Nav as BaseNav } from 'rspress/theme';

const Layout = () => {
  return <BaseLayout />;
};

export const Nav = () => {
  return (
    <>
      custom word
      <BaseNav />
    </>
  );
};

export default {
  ...Theme,
  Layout,
};

export * from 'rspress/theme';

Image

@liuwenzhuang
Copy link
Contributor Author

liuwenzhuang commented Nov 12, 2024

I found how to extend deault theme, which I need is the specific sigular components from @rspress/theme-default, and replace custom word area which from your example. For example, if I want to add a custom outsides links in navbar, the NavMenuGroup components from @rspress/theme-default is the best choice. @Timeless0911

@Timeless0911
Copy link
Collaborator

Why not use socialLinks? And currently we does not provide exports of internal components like NavMenuGroup to extend part of Nav.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants