Skip to content

Commit 070aba8

Browse files
[update] integration guides
1 parent c0fc148 commit 070aba8

File tree

4 files changed

+128
-92
lines changed

4 files changed

+128
-92
lines changed

docs/guides/integration_with_angular.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -37,35 +37,35 @@ cd my-angular-event-calendar-app
3737
Install dependencies and start the dev server. For this, use the [**yarn**](https://yarnpkg.com/) package manager:
3838

3939
~~~json
40-
yarn install
40+
yarn
4141
yarn start
4242
~~~
4343

4444
The app should run on a localhost (for instance `http://localhost:3000`).
4545

4646
## Creating Event Calendar
4747

48-
Now you should get the DHTMLX Event Calendar code. First of all, stop the app and proceed with installing the Event Calendar package.
48+
Now you should get the DHTMLX Event Calendar source code. First of all, stop the app and proceed with installing the Event Calendar package.
4949

5050
### Step 1. Package installation
5151

5252
Download the [**trial Event Calendar package**](/how_to_start/#installing-event-calendar-via-npm-and-yarn) and follow steps mentioned in the README file. Note that trial Event Calendar is available 30 days only.
5353

5454
### Step 2. Component creation
5555

56-
Now you need to create a component, to add an Event Calendar into the application. Create the **event-calendar** folder in the **src/app/** directory, add a new file into it and name it **event-calendar.component.ts**. Then complete the steps described below.
56+
Now you need to create an Angular component, to add Event Calendar into the application. Create the **event-calendar** folder in the **src/app/** directory, add a new file into it and name it **event-calendar.component.ts**. Then complete the steps described below.
5757

5858
#### Import source files
5959

6060
Open the file and import Event Calendar source files. Note that:
6161

62-
- if you use PRO version and install the Event Calendar package from a local folder, the imported paths look like this:
62+
- if you use PRO version and install the Event Calendar package from a local folder, the imported path looks like this:
6363

6464
~~~jsx
6565
import { EventCalendar } from 'dhx-eventcalendar-package';
6666
~~~
6767

68-
- if you use the trial version of Event Calendar, specify the following paths:
68+
- if you use the trial version of Event Calendar, specify the following path:
6969

7070
~~~jsx
7171
import { EventCalendar } from '@dhx/trial-eventcalendar';
@@ -149,8 +149,8 @@ import { Component, ElementRef, OnInit, ViewChild, OnDestroy, ViewEncapsulation
149149

150150
@Component({
151151
encapsulation: ViewEncapsulation.None,
152-
selector: "event-calendar", // a template name used in the "app.component.ts" file as <event-calendar />
153-
styleUrls: ["./event-calendar.component.css"], // include a css file
152+
selector: "event-calendar",
153+
styleUrls: ["./event-calendar.component.css"],
154154
template: `<div #container class="widget"></div>`,
155155
})
156156

@@ -160,15 +160,15 @@ export class EventCalendarComponent implements OnInit, OnDestroy {
160160
private _calendar!: EventCalendar;
161161

162162
ngOnInit() {
163-
const events = getData();
163+
const events = getData(); // initialize data property
164164
this._calendar = new EventCalendar(this.calendar_container.nativeElement, {
165165
events, // apply event data
166166
date: new Date(2024, 5, 10),
167167
});
168168
}
169169

170170
ngOnDestroy(): void {
171-
this._calendar.destructor(); // destruct Event Calendar
171+
this._calendar.destructor();
172172
}
173173
}
174174
~~~
@@ -182,8 +182,8 @@ import { Component, ElementRef, OnInit, ViewChild, OnDestroy, ViewEncapsulation
182182

183183
@Component({
184184
encapsulation: ViewEncapsulation.None,
185-
selector: "event-calendar", // a template name used in the "app.component.ts" file as <event-calendar />
186-
styleUrls: ["./event-calendar.component.css"], // include a css file
185+
selector: "event-calendar",
186+
styleUrls: ["./event-calendar.component.css"],
187187
template: `<div #container class="widget"></div>`,
188188
})
189189

@@ -203,14 +203,14 @@ export class EventCalendarComponent implements OnInit, OnDestroy {
203203
}
204204

205205
ngOnDestroy(): void {
206-
this._calendar.destructor(); // destruct Event Calendar
206+
this._calendar.destructor();
207207
}
208208
}
209209
~~~
210210

211-
The `this._calendar.parse(data)` method provides data reloading on each applied change.
211+
The `parse(data)` method provides data reloading on each applied change.
212212

213-
Now the Event Calendar component is ready. When the element will be added to the page, it will initialize the Event Calendar object with data. You can provide necessary configuration settings as well. Visit our [Event Calendar API docs](/api/overview/properties_overview/) to check the full list of available properties.
213+
Now the Event Calendar component is ready to use. When the element will be added to the page, it will initialize the Event Calendar with data. You can provide necessary configuration settings as well. Visit our [Event Calendar API docs](/api/overview/properties_overview/) to check the full list of available properties.
214214

215215
#### Handling events
216216

docs/guides/integration_with_react.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ DHTMLX Event Calendar is compatible with **React**. We have prepared code exampl
1818
Before you start to create a new project, install [**Vite**](https://vitejs.dev/) (optional) and [**Node.js**](https://nodejs.org/en/).
1919
:::
2020

21-
You can create a basic **React** project or use **React with Vite**:
21+
You can create a basic **React** project or use **React with Vite**. Let's name the project as **my-react-event-calendar-app**:
2222

2323
~~~json
2424
npx create-vite my-react-event-calendar-app --template react
2525
~~~
2626

2727
### Installation of dependencies
2828

29-
Go to the app directory. Let's name the project as **my-react-event-calendar-app** and run:
29+
Go to the new created app directory:
3030

3131
~~~json
3232
cd my-react-event-calendar-app
@@ -37,8 +37,8 @@ Install dependencies and start the dev server. For this, use a package manager:
3737
- if you use [**yarn**](https://yarnpkg.com/), run the following commands:
3838

3939
~~~json
40-
yarn install
41-
yarn dev
40+
yarn
41+
yarn start
4242
~~~
4343

4444
- if you use [**npm**](https://www.npmjs.com/), run the following commands:
@@ -52,7 +52,7 @@ The app should run on a localhost (for instance `http://localhost:3000`).
5252

5353
## Creating Event Calendar
5454

55-
Now you should get the DHTMLX Event Calendar code. First of all, stop the app and proceed with installing the Event Calendar package.
55+
Now you should get the DHTMLX Event Calendar source code. First of all, stop the app and proceed with installing the Event Calendar package.
5656

5757
### Step 1. Package installation
5858

@@ -93,7 +93,7 @@ import { useEffect, useRef } from "react";
9393
import { EventCalendar } from "@dhx/trial-eventcalendar";
9494
import "@dhx/trial-eventcalendar/dist/event-calendar.css";
9595

96-
export default function CalendarComponent(props) {
96+
export default function EventCalendarComponent(props) {
9797
let container = useRef(); // initialize container for Event Calendar
9898

9999
useEffect(() => {
@@ -146,7 +146,7 @@ export function getData() {
146146

147147
Then open the ***App.js*** file and import data. After this you can pass data into the new created `<EventCalendar/>` components as **props**:
148148

149-
~~~jsx {2,5-6} title="App.jsx"
149+
~~~jsx {2,5-6} title="App.js"
150150
import EventCalendar from "./EventCalendar";
151151
import { getData } from "./data";
152152

@@ -165,12 +165,12 @@ import { useEffect, useRef } from "react";
165165
import { EventCalendar } from "@dhx/trial-eventcalendar";
166166
import "@dhx/trial-eventcalendar/dist/event-calendar.css";
167167

168-
export default function CalendarComponent(props) {
168+
export default function EventCalendarComponent(props) {
169169
let container = useRef();
170170

171171
useEffect(() => {
172172
const calendar = new EventCalendar(container.current, {
173-
events: props.events,
173+
events: props.events, // apply event data
174174
date: props.date,
175175
// other configuration properties
176176
});
@@ -191,7 +191,7 @@ import { useEffect, useRef } from "react";
191191
import { EventCalendar } from "@dhx/trial-eventcalendar";
192192
import "@dhx/trial-eventcalendar/dist/event-calendar.css";
193193

194-
export default function CalendarComponent(props) {
194+
export default function EventCalendarComponent(props) {
195195
let container = useRef();
196196

197197
let events = props.events;
@@ -211,9 +211,9 @@ export default function CalendarComponent(props) {
211211
}
212212
~~~
213213

214-
The `calendar.parse(data)` method provides data reloading on each applied change.
214+
The `parse(data)` method provides data reloading on each applied change.
215215

216-
Now the Event Calendar component is ready. When the element will be added to the page, it will initialize the Event Calendar object with data. You can provide necessary configuration settings as well. Visit our [Event Calendar API docs](/api/overview/properties_overview/) to check the full list of available properties.
216+
Now the Event Calendar component is ready. When the element will be added to the page, it will initialize the Event Calendar with data. You can provide necessary configuration settings as well. Visit our [Event Calendar API docs](/api/overview/properties_overview/) to check the full list of available properties.
217217

218218
#### Handling events
219219

@@ -239,9 +239,9 @@ useEffect(() => {
239239

240240
### Step 3. Adding Event Calendar into the app
241241

242-
To add the component into the app, open the **App.jsx** file and replace the default code with the following one:
242+
To add the component into the app, open the **App.js** file and replace the default code with the following one:
243243

244-
~~~jsx title="App.jsx"
244+
~~~jsx title="App.js"
245245
import EventCalendar from "./EventCalendar";
246246
import { getData } from "./data";
247247

0 commit comments

Comments
 (0)