Skip to content

Commit a49826d

Browse files
[update] Integration guides (#25)
* [update] Angular integration guide * [update] React integration guide * [update] Angular and React integration guides (styles) * [update] React and Vue integration guides * [update] Svelte integration guide
1 parent 901c701 commit a49826d

File tree

3 files changed

+58
-81
lines changed

3 files changed

+58
-81
lines changed

docs/guides/integration_with_react.md

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ export default function EventCalendarComponent(props) {
111111

112112
#### Adding styles
113113

114-
To display Event Calendar correctly, you need to provide the corresponding styles. You can use the **index.css** file to specify important styles for Event Calendar and its container:
114+
To display Event Calendar correctly, you need to specify important styles for Event Calendar and its container in the main css file of the project:
115115

116116
~~~css title="index.css"
117117
/* specify styles for initial page */
@@ -160,7 +160,7 @@ export function getData() {
160160
text: ' Olympic Stadium - Munich ',
161161
details: ' Munich, GER '
162162
}
163-
];
163+
]
164164
}
165165
~~~
166166

@@ -257,22 +257,6 @@ useEffect(() => {
257257
// ...
258258
~~~
259259

260-
### Step 3. Adding Event Calendar into the app
261-
262-
To add the component into the app, open the **App.js** file and replace the default code with the following one:
263-
264-
~~~jsx title="App.js"
265-
import EventCalendar from "./EventCalendar";
266-
import { getData } from "./data";
267-
268-
function App() {
269-
const events= getData();
270-
return <EventCalendar events={events} date={new Date(2024, 5, 10)} />;
271-
}
272-
273-
export default App;
274-
~~~
275-
276260
After that, you can start the app to see Event Calendar loaded with data on a page.
277261

278262
![Event Calendar initialization](../assets/trial_eventcalendar.png)

docs/guides/integration_with_svelte.md

Lines changed: 28 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,17 @@ DHTMLX Event Calendar is compatible with **Svelte**. We have prepared code examp
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-
There are several ways of creating a **Svelte** project:
22-
23-
- you can use the [**SvelteKit**](https://kit.svelte.dev/)
24-
25-
or
26-
27-
- you can also use **Svelte with Vite** (but without SvelteKit):
21+
To create a **Svelte** JS project, run the following command:
2822

2923
~~~json
3024
npm create vite@latest
3125
~~~
3226

33-
Check the details in the [related article](https://svelte.dev/docs/introduction#start-a-new-project-alternatives-to-sveltekit).
27+
Let's name the project as **my-svelte-event-calendar-app**.
3428

3529
### Installation of dependencies
3630

37-
Let's name the project as **my-svelte-event-calendar-app** and go to the app directory:
31+
Go to the app directory:
3832

3933
~~~json
4034
cd my-svelte-event-calendar-app
@@ -44,9 +38,9 @@ Install dependencies and start the dev server. For this, use a package manager:
4438

4539
- if you use [**yarn**](https://yarnpkg.com/), run the following commands:
4640

47-
~~~json
41+
~~~jsx
4842
yarn
49-
yarn start
43+
yarn start // or yarn dev
5044
~~~
5145

5246
- if you use [**npm**](https://www.npmjs.com/), run the following commands:
@@ -100,7 +94,7 @@ In this tutorial you can see how to configure the **trial** version of Event Cal
10094

10195
To display Event Calendar on the page, you need to create the container for Event Calendar, and initialize this component using the corresponding constructor:
10296

103-
~~~html {3,6,10-11} title="EventCalendar.svelte"
97+
~~~html {3,6,10-11,19} title="EventCalendar.svelte"
10498
<script>
10599
import { onMount, onDestroy } from "svelte";
106100
import { EventCalendar } from "@dhx/trial-eventcalendar";
@@ -119,7 +113,27 @@ To display Event Calendar on the page, you need to create the container for Even
119113
});
120114
</script>
121115

122-
<div bind:this={container} style="width: 100%; height: 100%;"></div>
116+
<div bind:this={container} class="widget"></div>
117+
~~~
118+
119+
#### Adding styles
120+
121+
To display Event Calendar correctly, you need to specify important styles for Event Calendar and its container in the main css file of the project:
122+
123+
~~~css title="main.css"
124+
/* specify styles for initial page */
125+
html,
126+
body,
127+
#app { /* make sure that you use the #app root container */
128+
height: 100%;
129+
padding: 0;
130+
margin: 0;
131+
}
132+
133+
/* specify styles for the Event Calendar container */
134+
.widget {
135+
height: 100%;
136+
}
123137
~~~
124138

125139
#### Loading data
@@ -196,7 +210,7 @@ onDestroy(() => {
196210
});
197211
</script>
198212

199-
<div bind:this={container} style="width: 100%; height: 100%;"></div>
213+
<div bind:this={container} class="widget"></div>
200214
~~~
201215

202216
You can also use the [`parse()`](/api/methods/js_eventcalendar_parse_method/) method inside the `onMount()` method of Svelte to load data into Event Calendar:
@@ -258,21 +272,6 @@ onDestroy(() => {
258272
// ...
259273
~~~
260274

261-
### Step 3. Adding Event Calendar into the app
262-
263-
To add the component into the app, open the **App.svelte** file and replace the default code with the following one:
264-
265-
~~~html title="App.svelte"
266-
<script>
267-
import EventCalendar from "./EventCalendar.svelte";
268-
import { getData } from "./data.js";
269-
270-
const events = getData();
271-
</script>
272-
273-
<EventCalendar events={events} date={new Date(2024, 5, 10)} />
274-
~~~
275-
276275
After that, you can start the app to see Event Calendar loaded with data on a page.
277276

278277
![Event Calendar initialization](../assets/trial_eventcalendar.png)

docs/guides/integration_with_vue.md

Lines changed: 28 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ Install dependencies and start the dev server. For this, use a package manager:
4040

4141
- if you use [**yarn**](https://yarnpkg.com/), run the following commands:
4242

43-
~~~json
43+
~~~jsx
4444
yarn
45-
yarn start
45+
yarn start // or yarn dev
4646
~~~
4747

4848
- if you use [**npm**](https://www.npmjs.com/), run the following commands:
@@ -64,7 +64,7 @@ Download the [**trial Event Calendar package**](/how_to_start/#installing-event-
6464

6565
### Step 2. Component creation
6666

67-
Now you need to create a Vue component, to add Event Calendar into the application. Create a new file in the ***src/components/*** directory and name it ***EventCalendar***.
67+
Now you need to create a Vue component, to add Event Calendar into the application. Create a new file in the ***src/components/*** directory and name it ***EventCalendar.vue***.
6868

6969
#### Import source files
7070

@@ -96,7 +96,7 @@ In this tutorial you can see how to configure the **trial** version of Event Cal
9696
9797
To display Event Calendar on the page, you need to create the container for Event Calendar, and initialize this component using the corresponding constructor:
9898
99-
~~~html {2,7-8} title="EventCalendar.vue"
99+
~~~html {2,7-8,18} title="EventCalendar.vue"
100100
<script>
101101
import { EventCalendar } from "@dhx/trial-eventcalendar";
102102
import "@dhx/trial-eventcalendar/dist/event-calendar.css";
@@ -114,10 +114,30 @@ export default {
114114
</script>
115115

116116
<template>
117-
<div ref="container" style="width: 100%; height: 100%"></div>
117+
<div ref="container" class="widget"></div>
118118
</template>
119119
~~~
120120

121+
#### Adding styles
122+
123+
To display Event Calendar correctly, you need to specify important styles for Event Calendar and its container in the main css file of the project:
124+
125+
~~~css title="main.css"
126+
/* specify styles for initial page */
127+
html,
128+
body,
129+
#app { /* make sure that you use the #app root container */
130+
height: 100%;
131+
padding: 0;
132+
margin: 0;
133+
}
134+
135+
/* specify styles for the Event Calendar container */
136+
.widget {
137+
height: 100%;
138+
}
139+
~~~
140+
121141
#### Loading data
122142

123143
To add data into the Event Calendar, you need to provide a data set. You can create the ***data.js*** file in the ***src/*** directory and add some data into it:
@@ -203,7 +223,7 @@ export default {
203223
</script>
204224

205225
<template>
206-
<div ref="container" style="width: 100%; height: 100%;"></div>
226+
<div ref="container" class="widget"></div>
207227
</template>
208228
~~~
209229

@@ -233,7 +253,7 @@ export default {
233253
</script>
234254

235255
<template>
236-
<div ref="container" style="width: 100%; height: 100%"></div>
256+
<div ref="container" class="widget"></div>
237257
</template>
238258
~~~
239259

@@ -259,39 +279,13 @@ export default {
259279
console.log(obj);
260280
});
261281
}
282+
// ...
262283
}
263284
</script>
264285

265286
<!--...-->
266287
~~~
267288

268-
### Step 3. Adding Event Calendar into the app
269-
270-
To add the component into the app, open the **App.vue** file and replace the default code with the following one:
271-
272-
~~~html title="App.vue"
273-
<script>
274-
import EventCalendar from "./components/EventCalendar.vue";
275-
import { getData } from "./data";
276-
277-
export default {
278-
components: { EventCalendar },
279-
data() {
280-
const events = getData();
281-
const date = new Date(2024, 5, 10);
282-
return {
283-
events,
284-
date
285-
};
286-
}
287-
};
288-
</script>
289-
290-
<template>
291-
<EventCalendar :events="records" :date="date" />
292-
</template>
293-
~~~
294-
295289
After that, you can start the app to see Event Calendar loaded with data on a page.
296290

297291
![Event Calendar initialization](../assets/trial_eventcalendar.png)

0 commit comments

Comments
 (0)