@dotcms/react 0.0.1-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,141 @@
1
+ # @dotcms/react
2
+
3
+ `@dotcms/react` is the official set of React components and hooks designed to work seamlessly with dotCMS, making it easy to render dotCMS pages an use the page builder.
4
+
5
+ ## Features
6
+
7
+ - A collection of React components and hooks tailored to render dotCMS pages.
8
+ - Streamlined integration with dotCMS page editor.
9
+ - Improved development experience with comprehensive TypeScript typings.
10
+
11
+ ## Installation
12
+
13
+ Install the package via npm:
14
+
15
+ ```bash
16
+ npm install @dotcms/react
17
+ ```
18
+
19
+ Or using Yarn:
20
+
21
+ ```bash
22
+ yarn add @dotcms/react
23
+ ```
24
+
25
+ ## Components
26
+
27
+ ### `DotcmsLayout`
28
+
29
+ A functional component that renders a layout for a dotCMS page.
30
+
31
+ #### Props
32
+
33
+ - **entity**: The context for a dotCMS page.
34
+
35
+ #### Usage
36
+
37
+ ```javascript
38
+ import { DotcmsLayout } from '@dotcms/react';
39
+
40
+ const MyPage = ({ entity }) => {
41
+ return <DotcmsLayout entity={entity} />;
42
+ };
43
+ ```
44
+
45
+ ## Hooks
46
+
47
+ ### `useDotcmsPageContext`
48
+
49
+ A custom React hook that provides access to the `PageProviderContext`.
50
+
51
+ #### Returns
52
+
53
+ - `PageProviderContext | null`: The context value or `null` if it's not available.
54
+
55
+ #### Usage
56
+
57
+ ```javascript
58
+ import { useDotcmsPageContext } from '@dotcms/react';
59
+
60
+ const MyComponent = () => {
61
+ const context = useDotcmsPageContext();
62
+ // Use the context
63
+ };
64
+ ```
65
+
66
+ ### `usePageEditor`
67
+
68
+ A custom React hook that sets up the page editor for a dotCMS page.
69
+
70
+ #### Parameters
71
+
72
+ - **props**: `PageEditorOptions` - The options for the page editor. Includes a `reloadFunction` and a `pathname`.
73
+
74
+ #### Returns
75
+
76
+ - `React.RefObject<HTMLDivElement>[]`: A reference to the rows of the page.
77
+
78
+ #### Usage
79
+
80
+ ```javascript
81
+ import { usePageEditor } from '@dotcms/react';
82
+
83
+ const MyEditor = () => {
84
+ const rowsRef = usePageEditor({ pathname: '/my-page' });
85
+ // Use the rowsRef
86
+ };
87
+ ```
88
+
89
+ ## Context Providers
90
+
91
+ ### `PageProvider`
92
+
93
+ A functional component that provides a context for a dotCMS page.
94
+
95
+ #### Props
96
+
97
+ - **entity**: The entity representing the page's data.
98
+ - **children**: The children components.
99
+
100
+ #### Usage
101
+
102
+ ```javascript
103
+ import { PageProvider } from '@dotcms/react';
104
+
105
+ const MyApp = ({ entity }) => {
106
+ return (
107
+ <PageProvider entity={entity}>
108
+ {/* children */}
109
+ </PageProvider>
110
+ );
111
+ };
112
+ ```
113
+
114
+ ## Contributing
115
+
116
+ GitHub pull requests are the preferred method to contribute code to dotCMS. Before any pull requests can be accepted, an automated tool will ask you to agree to the [dotCMS Contributor's Agreement](https://gist.github.com/wezell/85ef45298c48494b90d92755b583acb3).
117
+
118
+
119
+ ## Licensing
120
+
121
+ dotCMS comes in multiple editions and as such is dual licensed. The dotCMS Community Edition is licensed under the GPL 3.0 and is freely available for download, customization and deployment for use within organizations of all stripes. dotCMS Enterprise Editions (EE) adds a number of enterprise features and is available via a supported, indemnified commercial license from dotCMS. For the differences between the editions, see [the feature page](http://dotcms.com/cms-platform/features).
122
+
123
+ ## Support
124
+
125
+ If you need help or have any questions, please [open an issue](https://github.com/dotCMS/core/issues/new/choose) in the GitHub repository.
126
+
127
+ ## Documentation
128
+
129
+ Always refer to the official [DotCMS documentation](https://www.dotcms.com/docs/latest/) for comprehensive guides and API references.
130
+
131
+ ## Getting Help
132
+
133
+ | Source | Location |
134
+ | --------------- | ------------------------------------------------------------------- |
135
+ | Installation | [Installation](https://dotcms.com/docs/latest/installation) |
136
+ | Documentation | [Documentation](https://dotcms.com/docs/latest/table-of-contents) |
137
+ | Videos | [Helpful Videos](http://dotcms.com/videos/) |
138
+ | Code Examples | [Codeshare](https://dotcms.com/codeshare/) |
139
+ | Forums/Listserv | [via Google Groups](https://groups.google.com/forum/#!forum/dotCMS) |
140
+ | Twitter | @dotCMS |
141
+ | Main Site | [dotCMS.com](https://dotcms.com/) |