Skip to content

Commit a71c99e

Browse files
authored
Merge pull request #109 from HubSpot/jm/udpate-docs
Archive repo docs and update readme
2 parents 82835d5 + 4c185d6 commit a71c99e

79 files changed

Lines changed: 35 additions & 4640 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 31 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,52 @@
11
# HubSpot CMS React
22

3-
## Documentation
4-
5-
Check out an expanded documentation page at <a href="https://github.hubspot.com/cms-react/" target="_blank">https://github.hubspot.com/cms-react/</a>
6-
7-
## Welcome!
8-
9-
Thank you for taking the time to learn about HubSpot CMS React. As always our goal is to solve for our customers so we welcome any and all feedback. Chat away in [\#cms-react](https://hubspotdev.slack.com/archives/C04AY1H2204) with other HubSpot developers who are pushing forward with developing with React on the Hubspot CMS. If you do not have access to the developer slack, you can request access [here](https://developers.hubspot.com/slack).
10-
11-
## How do React modules on the CMS work?
12-
13-
CMS React Modules and Partials are building blocks you can use to write React and JavaScript instead of HubL inside the HubSpot CMS. Note this doesn’t mean you will switch entirely away from HubL, rather we want to provide a pathway to begin writing React to render on both on the server and client. JS modules and partials are built from React components and can directly be referenced via HubL tags in your templates.
14-
15-
## Can I use React modules on my CMS account?
3+
A collection of CMS React examples for building on the HubSpot CMS.
164

17-
Yes! Working with React modules is generally available and can be used with all tiers of the CMS, including free.
5+
## Table of Contents
186

19-
## [Default React modules](default-react-modules)
7+
- [Overview](#overview)
8+
- [Documentation](#documentation)
9+
- [Examples](#examples)
10+
- [Contributing](#contributing)
11+
- [Support](#support)
2012

21-
This directory contains a copy of all of our internal default React modules. As React modules do not appear in the Design manager, we made them available within this public repository so you can make your own copy and edit as you like. The modules you find in this directory are synced up with our internal code to ensure we keep them up to date.
13+
---
2214

23-
### What if I don't see a default React module in this repo but that is available for use within Hubspot?
24-
Some default React modules contain code that is internal to Hubspot and thus cannot be used in a general way by external developers. If you are are seeking to utilize one of these modules, or otherwise get a better sense of how it works, please reach out to a developer advocate for more information.
15+
## Overview
2516

26-
## [React module boilerplate](react-module-boilerplate)
17+
This repo demonstrates how to build React modules and "islands" for the HubSpot CMS. You'll find step-by-step examples, best practices, and customizable boilerplates to get you up and running quickly.
2718

28-
If you'd like to get started with your own React module or one of our defaults, we have provided a boilerplate project for you to pick up and get started right away. This boilerplate comes complete with a Sample module so you can test working with this repo with only a few steps on your part. In order to get working with this boilerplate you simply have to:
29-
30-
- Become familiar with working with our CLI, if you are not already, with our [Hubspot CLI documentation](https://developers.hubspot.com/docs/cms/guides/getting-started)
31-
- Run `hs init` and select your portal.
32-
- Within the react-module-boilerplate/src run `yarn deploy` or `npm deploy`, which is a helper script we offer which runs the `hs project upload` CLI command.
33-
- You will be prompted to create this project in your portal. Confirm and the project will be created.
34-
- Wait a few moments for the deploy to finish. You can view the projects within your portal at `https://app.hubspot.com/developer-projects/{YOUR_PORTAL_ID}`
19+
## Documentation
3520

36-
Once the module is uploaded you should be able to see it when you go to edit a page, adding it like any other module.
21+
- Official HubSpot CMS React guide:
22+
https://developers.hubspot.com/docs/guides/cms/react/overview
3723

3824
## Examples
25+
Each folder under `examples/` is a standalone example focused on a specific use case or feature. If you are just getting started with CMS React, the following examples are the best places to start:
3926

40-
In this repository is example usage of some of key features of React modules. These examples are are best understood alongside our official <a href="https://github.hubspot.com/cms-react/" target="_blank">docs</a>. You can quickly try things out without any local setup by [opening this repo in Codesandbox.io](https://codesandbox.io/p/sandbox/stoic-pateu-g20chg?file=%2Fcms-react%2FREADME.md).
41-
42-
### [Getting Started](examples/getting-started)
43-
44-
The "Getting Started" example is the most up to date example of CMS React basics. It illustrates the definition and development of Modules with React, uses 3rd party dependencies, islands, and CSS Modules.
45-
46-
### [Hello World](examples/hello-world)
47-
48-
**NOTE:** this is an older example, and [Getting Started](getting-started) is a better first example
27+
- **[getting-started-project-theme](examples/getting-started-project-theme)**
28+
Building a CMS theme with React and Projects
29+
- **[getting-started](examples/getting-started)**
30+
Building a standalone Project with React modules that can be used across CMS themes
4931

50-
The "Hello World" example combines partials, modules, islands and CSS modules for styling to show a more cohesive yet straightforward example of how CMS React components and APIs work together.
32+
If you want to bootstrap a new Project with CMS React you can run `npx @hubspot/create-cms-theme@latest` which will create a Project starting point for you to build upon. [Learn More](https://www.npmjs.com/package/@hubspot/create-cms-theme)
5133

52-
### [Styling](examples/styling)
34+
---
5335

54-
In this example, we take a look at three different approaches to styling React components. This is not an exhaustive list and there are many ways that styles can be organized and implemented.
36+
## Contributing
5537

56-
### [Islands](examples/islands)
38+
We welcome bug reports and PRs to update or add new examples:
5739

58-
Islands are a key concept for React modules in HubSpot. In addition to stitching server-rendered React components into the HTML generated by HubL, JS modules and partials support client-side interactivity with islands. Similar to the islands concept from [Astro](https://astro.build/), [Fresh](https://fresh.deno.dev/), and others, you can add an `<Island />` inside your JS module or partial to automatically code-split and render a component on both the server and client. In addition to allowing you to reuse JavaScript code between the server and browser, islands help you write performant websites by giving you precise control over what JavaScript is shipped to the browser and when it runs.
40+
1. Fork this repo
41+
2. Create a feature branch (`git checkout -b my-new-example`)
42+
3. Commit your changes (`git commit -m "Add amazing example"`)
43+
4. Open a PR
5944

60-
### [Graphql + Storybook](examples/graphql-storybook)
45+
---
6146

62-
GraphQL is the future for querying HubSpot data in your CMS pages. As part of JS Modules, a developer can export a GraphQL query string and the Module's root component will then be passed the query result. Additionally we show how a Module that uses GraphQL can be developed using our Storybook integration. This integration will automatically understand the field types of a module and generate controls for a Storybook story.
47+
## Support
6348

64-
### [Todo MVC](examples/todo-mvc)
49+
Chat with the community on Slack:
50+
https://developers.hubspot.com/docs/getting-started/slack/developer-slack
6551

66-
It seems with every new FE technology on the web comes an implemetation of TodoMVC. We didn't want to be left out and ported a recent version that made use of React and React hooks to work as a JS Module with Islands. Additionally there is an example of our `sharedIslandReducer` which provides a redux like interface for sharing state across islands.
52+
---

docs/.vitepress/config.ts

Lines changed: 3 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -1,113 +1,16 @@
11
import { defineConfig } from 'vitepress';
2-
import fieldTypesSidebar from '../field-types/typedoc-sidebar.json';
32

43
// https://vitepress.dev/reference/site-config
54
export default defineConfig({
65
title: 'HubSpot - CMS React',
7-
description: 'Documentation for HubSpot CMS React',
6+
description: 'Archived documentation site for HubSpot CMS React',
87
base: '/cms-react/',
98
themeConfig: {
109
// https://vitepress.dev/reference/default-theme-config
1110
nav: [
12-
{ text: 'Home', link: '/' },
13-
{
14-
text: 'Getting Started',
15-
link: 'https://github.com/HubSpot/cms-react/tree/main/examples/hello-world',
16-
},
17-
{ text: 'API Reference', link: '/reference/project-structure' },
18-
{ text: 'Appendix', link: '/appendix' },
11+
{ text: 'Official Docs', link: 'https://developers.hubspot.com/docs/guides/cms/react/overview' },
12+
{ text: 'Examples', link: 'https://github.com/HubSpot/cms-react/tree/main/examples' },
1913
{ text: 'Release Log', link: 'release-log' },
2014
],
21-
22-
sidebar: {
23-
'/': [
24-
{
25-
text: 'Documentation',
26-
items: [
27-
{
28-
text: 'Getting started',
29-
link: 'https://github.com/HubSpot/cms-react/tree/main/examples/hello-world',
30-
},
31-
{ text: 'API reference', link: '/reference/project-structure' },
32-
{ text: 'Field types', link: '/field-types/' },
33-
{ text: 'Appendix', link: '/appendix' },
34-
{ text: 'Release Log', link: 'release-log' },
35-
],
36-
},
37-
],
38-
'/reference/': {
39-
base: '/reference/',
40-
items: [
41-
{
42-
text: 'API Reference',
43-
items: [
44-
{
45-
text: 'Project Structure',
46-
link: 'project-structure',
47-
},
48-
{ text: 'React Partials', link: 'js-partials' },
49-
{
50-
text: 'React Modules',
51-
link: 'js-modules',
52-
items: [
53-
{
54-
text: 'Directory Structure',
55-
link: 'js-modules#directory-structure-requirements',
56-
},
57-
{
58-
text: 'Module Fields',
59-
link: 'js-modules#module-fields',
60-
},
61-
{ text: 'GraphQL', link: 'js-modules#graphql' },
62-
{ text: 'hublDataTemplate', link: 'js-modules#hubldatatemplate' },
63-
],
64-
},
65-
{ text: 'Islands', link: 'islands' },
66-
{ text: '@hubspot/cms-components', link: 'cms-components' },
67-
{ text: '@hubspot/cms-dev-server', link: 'cms-dev-server' },
68-
{ text: 'Styling', link: 'styling' },
69-
{ text: 'Static assets', link: 'static-assets' },
70-
{
71-
text: 'Third-party dependencies',
72-
link: 'dependencies',
73-
},
74-
{ text: 'Prerendering', link: 'prerendering' },
75-
{ text: 'Testing', link: 'testing' },
76-
{ text: 'Data Fetching', link: 'data-fetching' },
77-
{ text: 'Secrets', link: 'secrets' },
78-
{ text: 'Working with Serverless', link: 'serverless' },
79-
{ text: 'Build Health Checks', link: 'build-healthchecks' },
80-
],
81-
},
82-
{
83-
text: 'Module field types',
84-
link: '../field-types/',
85-
},
86-
],
87-
},
88-
'/field-types/': {
89-
base: '/field-types/',
90-
items: fieldTypesSidebar.map((sidebarItem) => {
91-
// remove nesting in sidebar, at least while it doesn't include
92-
// anything
93-
const { items, collapsed, ...rest } = sidebarItem;
94-
if (items.length === 0) {
95-
return rest;
96-
}
97-
return sidebarItem;
98-
}),
99-
},
100-
},
101-
102-
socialLinks: [
103-
{
104-
icon: 'github',
105-
link: 'https://github.com/HubSpot/cms-react/',
106-
},
107-
],
108-
109-
search: {
110-
provider: 'local'
111-
}
11215
},
11316
});

0 commit comments

Comments
 (0)