Skip to content

Commit

Permalink
[update] Angular and React integration guides (styles) (#24)
Browse files Browse the repository at this point in the history
* [update] Angular integration guide

* [update] React integration guide

* [update] Angular and React integration guides (styles)
  • Loading branch information
serhiipylypchuk1991 authored Aug 26, 2024
1 parent 6d5f05b commit 901c701
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 8 deletions.
2 changes: 0 additions & 2 deletions docs/guides/integration_with_angular.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,6 @@ body {

/* specify styles for the Event Calendar container */
.widget {
position: relative;
width: 100%;
height: 100%;
}
~~~
Expand Down
32 changes: 26 additions & 6 deletions docs/guides/integration_with_react.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Before you start to create a new project, install [**Vite**](https://vitejs.dev/
You can create a basic **React** project or use **React with Vite**. Let's name the project as **my-react-event-calendar-app**:

~~~json
npx create-vite my-react-event-calendar-app --template react
npx create-react-app my-react-event-calendar-app
~~~

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

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

return <div ref={container} style={{ width: "100%", height: "100%" }}></div>;
return <div ref={container} className="widget"></div>;
}
~~~

#### Adding styles

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:

~~~css title="index.css"
/* specify styles for initial page */
html,
body,
#root {
height: 100%;
padding: 0;
margin: 0;
}

/* specify styles for the Event Calendar container */
.widget {
height: 100%;
}
~~~

Expand Down Expand Up @@ -180,7 +200,7 @@ export default function EventCalendarComponent(props) {
}
}, []);

return <div ref={container} style={{ width: "100%", height: "100%" }}></div>;
return <div ref={container} className="widget"></div>;
}
~~~

Expand All @@ -207,13 +227,13 @@ export default function EventCalendarComponent(props) {
}
}, []);

return <div ref={container} style={{ width: "100%", height: "100%" }}></div>;
return <div ref={container} className="widget"></div>;
}
~~~

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

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.
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.

#### Handling events

Expand Down

0 comments on commit 901c701

Please sign in to comment.