Skip to content

Commit 901c701

Browse files
[update] Angular and React integration guides (styles) (#24)
* [update] Angular integration guide * [update] React integration guide * [update] Angular and React integration guides (styles)
1 parent 6d5f05b commit 901c701

File tree

2 files changed

+26
-8
lines changed

2 files changed

+26
-8
lines changed

docs/guides/integration_with_angular.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,6 @@ body {
127127

128128
/* specify styles for the Event Calendar container */
129129
.widget {
130-
position: relative;
131-
width: 100%;
132130
height: 100%;
133131
}
134132
~~~

docs/guides/integration_with_react.md

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Before you start to create a new project, install [**Vite**](https://vitejs.dev/
2121
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
24-
npx create-vite my-react-event-calendar-app --template react
24+
npx create-react-app my-react-event-calendar-app
2525
~~~
2626

2727
### Installation of dependencies
@@ -91,7 +91,7 @@ To display Event Calendar on the page, you need to create the container for Even
9191
~~~jsx {2,6,9-10} title="EventCalendar.jsx"
9292
import { useEffect, useRef } from "react";
9393
import { EventCalendar } from "@dhx/trial-eventcalendar";
94-
import "@dhx/trial-eventcalendar/dist/event-calendar.css";
94+
import "@dhx/trial-eventcalendar/dist/event-calendar.css"; // include Event Calendar styles
9595

9696
export default function EventCalendarComponent(props) {
9797
let container = useRef(); // initialize container for Event Calendar
@@ -105,7 +105,27 @@ export default function EventCalendarComponent(props) {
105105
};
106106
}, []);
107107

108-
return <div ref={container} style={{ width: "100%", height: "100%" }}></div>;
108+
return <div ref={container} className="widget"></div>;
109+
}
110+
~~~
111+
112+
#### Adding styles
113+
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:
115+
116+
~~~css title="index.css"
117+
/* specify styles for initial page */
118+
html,
119+
body,
120+
#root {
121+
height: 100%;
122+
padding: 0;
123+
margin: 0;
124+
}
125+
126+
/* specify styles for the Event Calendar container */
127+
.widget {
128+
height: 100%;
109129
}
110130
~~~
111131

@@ -180,7 +200,7 @@ export default function EventCalendarComponent(props) {
180200
}
181201
}, []);
182202

183-
return <div ref={container} style={{ width: "100%", height: "100%" }}></div>;
203+
return <div ref={container} className="widget"></div>;
184204
}
185205
~~~
186206

@@ -207,13 +227,13 @@ export default function EventCalendarComponent(props) {
207227
}
208228
}, []);
209229

210-
return <div ref={container} style={{ width: "100%", height: "100%" }}></div>;
230+
return <div ref={container} className="widget"></div>;
211231
}
212232
~~~
213233

214234
The `parse(data)` method provides data reloading on each applied change.
215235

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.
236+
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.
217237

218238
#### Handling events
219239

0 commit comments

Comments
 (0)