The default theme contains a series of components, you can implement custom themes by overriding or extending these components.
The Layout
component is the entry point component of the theme, which is used by Island.js to render the layout of the entire documentation site.
// theme/index.tsx
import { Layout } from 'islandjs';
It provides a series of slots through Props to achieve expansion, and the types are defined as follows:
interface LayoutProps {
/* Before home hero */
beforeHero?: React.ReactNode;
/* After home hero */
afterHero?: React.ReactNode;
/* Before home features */
beforeFeatures?: React.ReactNode;
/* After home features */
afterFeatures?: React.ReactNode;
/* Before doc footer */
beforeDocFooter?: React.ReactNode;
/* Doc page front */
beforeDoc?: React.ReactNode;
/* Doc page end */
afterDoc?: React.ReactNode;
/* Before the title of the navigation bar in the upper left corner */
beforeNavTitle?: React.ReactNode;
/* After the title of the navigation bar in the upper left corner
*/
afterNavTitle?: React.ReactNode;
/* Above the right outline column */
beforeOutline?: React.ReactNode;
/* Below the outline column on the right */
afterOutline?: React.ReactNode;
/* Top of the entire page */
top?: React.ReactNode;
/* Bottom of the entire page */
bottom?: React.ReactNode;
}
The HomeLayout
component is the theme's home page layout component, which is used by Island.js to render the home page layout.
// theme/index.tsx
import { HomeLayout } from 'islandjs';
The NotFoundLayout
component is the theme's 404 page layout component, which is used by Island.js to render the 404 page layout.
setup
is used to add an initialization logic, such as global event binding.
// theme/index.tsx
import { setup } from 'islandjs';