This collection of components has been specifically crafted for integration with the Developers Portal and the Help Center.
- Was this helpful?
- Hamburger Menu
- Markdown Renderer
- Search Input
- Detailed Search
- Table Of Contents
To get started, install the required dependencies using Yarn:
yarnBuild the library with the following command:
yarn run buildThe generated files can be found in the ./dist folder.
Explore and interact with the components using Storybook:
yarn storybookyarn build-storybook command is currently not working as expected.
The library utilizes components from the @vtex/brand-ui library. When using the Component Library, wrap all components in the @vtex/brand-ui ThemeProvider to ensure consistent styling. The Storybook documentation uses the ThemeProvider to show the expected styling.
To use the library, wrap it in the LibraryContextProvider. This provider requires the following props: sections, isPreview, fallback, sectionSelected, and locale.
Example usage:
<ThemeProvider>
<LibraryContextProvider
sections={sections}
isPreview={isPreview}
fallback={sidebarfallback}
sectionSelected={sectionSelected}
>
<Header />
<Content /> {/* Where all the components are used */}
<Footer />
</LibraryContextProvider>
</ThemeProvider>For search functionality, pass the appId, apiKey, and index for the search client. Create a configuration file and use the SearchConfig function:
import { SearchConfig } from '@vtexdocs/components'
const libraryConfig = {
appId: process.env.NEXT_PUBLIC_ALGOLIA_APP_ID || '',
apiKey: process.env.NEXT_PUBLIC_ALGOLIA_WRITE_KEY || '',
index: process.env.NEXT_PUBLIC_INDEX || '',
}
export default SearchConfig(libraryConfig)When testing changes to the component library in another repository (e.g., a documentation portal like helpcenter or devportal), follow these steps to ensure that your updates are correctly integrated. This process involves updating the components repository, applying the changes in the target repository, and verifying them in a local development environment.
-
Make the necessary changes to the components.
-
Commit your changes.
-
Build the project:
yarn run build
-
Commit the generated build files.
-
Push your changes to the remote repository.
If the branch is not yet in use in the package.json file in the target repository:
-
Update the
package.jsonfile in the target repository to reference the branch:"@vtexdocs/components": "https://github.com/vtexdocs/components.git#fix/slugify"
-
Install dependencies:
yarn
-
Start the development server:
yarn dev
If the branch is already in use:
-
Remove the branch reference in the
package.jsonfile in the target repository:"@vtexdocs/components": "https://github.com/vtexdocs/components.git"
-
Install dependencies:
yarn
-
Re-add the branch reference to the
package.jsonfile:"@vtexdocs/components": "https://github.com/vtexdocs/components.git#fix/slugify"
-
Reinstall dependencies:
yarn
-
Start the development server:
yarn dev
⚠️ If the local development environment isn't refreshing the components version properly, try erasing the.nextfolder locally before runningyarnandyarn devagain.
Feel free to explore and integrate these components into your project. If you encounter any issues, please refer to the documentation or reach out to our community for assistance.