Skip to content

Commit 5080893

Browse files
[update] React and Angular guides (styles) (#30)
* [update] redirects * [dev] update docusaurus from 3.3.2 to 3.5.2 * [update] test commit * [update] Angular integration guide * [update] React integration guide * [update] React and Angular guides (styles)
1 parent efc7c21 commit 5080893

File tree

2 files changed

+49
-19
lines changed

2 files changed

+49
-19
lines changed

docs/guides/integration_with_angular.md

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,9 @@ import { Component, ElementRef, OnInit, ViewChild, OnDestroy, ViewEncapsulation}
8989
encapsulation: ViewEncapsulation.None,
9090
selector: "kanban", // a template name used in the "app.component.ts" file as <kanban />
9191
styleUrls: ["./kanban.component.css"], // include the css file
92-
template: `<div class="component_container">
92+
template: `<div class = "component_container">
9393
<div #toolbar_container></div>
94-
<div #kanban_container style="height: calc(100% - 56px);"></div>
94+
<div #kanban_container class = "widget"></div>
9595
</div>`
9696
})
9797

@@ -132,18 +132,22 @@ To display Kanban correctly, you need to provide the corresponding styles. For t
132132

133133
/* specify styles for initial page */
134134
html,
135-
body {
136-
margin: 0;
137-
padding: 0;
135+
body{
138136
height: 100%;
137+
padding: 0;
138+
margin: 0;
139139
}
140140

141-
/* specify styles for the Kanban container */
141+
/* specify styles for Kanban and Toolbar container*/
142142
.component_container {
143143
height: 100%;
144-
width: 100%;
145144
margin: 0 auto;
146145
}
146+
147+
/* specify styles for Kanban container */
148+
.widget {
149+
height: calc(100% - 56px);
150+
}
147151
~~~
148152

149153
#### Loading data
@@ -213,9 +217,9 @@ import { Component, ElementRef, OnInit, ViewChild, OnDestroy, ViewEncapsulation}
213217
encapsulation: ViewEncapsulation.None,
214218
selector: "kanban",
215219
styleUrls: ["./kanban.component.css"],
216-
template: `<div class="component_container">
220+
template: `<div class = "component_container">
217221
<div #toolbar_container></div>
218-
<div #kanban_container style="height: calc(100% - 56px);"></div>
222+
<div #kanban_container class = "widget"></div>
219223
</div>`
220224
})
221225

@@ -260,9 +264,9 @@ import { Component, ElementRef, OnInit, ViewChild, OnDestroy, ViewEncapsulation}
260264
encapsulation: ViewEncapsulation.None,
261265
selector: "kanban",
262266
styleUrls: ["./kanban.component.css"],
263-
template: `<div class="component_container">
267+
template: `<div class = "component_container">
264268
<div #toolbar_container></div>
265-
<div #kanban_container style="height: calc(100% - 56px);"></div>
269+
<div #kanban_container class = "widget"></div>
266270
</div>`
267271
})
268272

docs/guides/integration_with_react.md

Lines changed: 34 additions & 8 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-kanban-app**:
2222

2323
~~~json
24-
npx create-vite my-react-kanban-app --template react
24+
npx create-react-app my-react-kanban-app
2525
~~~
2626

2727
### Installation of dependencies
@@ -91,7 +91,7 @@ To display Kanban with Toolbar on the page, you need to create containers for Ka
9191
~~~jsx {2,6-7,10-11,13-17} title="Kanban.jsx"
9292
import { useEffect, useRef } from "react";
9393
import { Kanban, Toolbar } from '@dhx/trial-kanban';
94-
import '@dhx/trial-kanban/dist/kanban.css';
94+
import '@dhx/trial-kanban/dist/kanban.css'; // include Kanban styles
9595

9696
export default function KanbanComponent(props) {
9797
let toolbar_container = useRef(); // initialize container for Toolbar
@@ -113,13 +113,39 @@ export default function KanbanComponent(props) {
113113
};
114114
}, []);
115115

116-
return <div>
116+
return <div className="component_container">
117117
<div ref={toolbar_container}></div>
118-
<div ref={kanban_container} style={{ height: "calc(100% - 56px)" }}></div>
118+
<div ref={kanban_container} className="widget"></div>
119119
</div>
120120
}
121121
~~~
122122

123+
#### Adding styles
124+
125+
To display Kanban correctly, you need to provide the corresponding styles. You can use the **index.css** file to specify important styles for Kanban and containers:
126+
127+
~~~css title="index.css"
128+
/* specify styles for initial page */
129+
html,
130+
body,
131+
#root {
132+
height: 100%;
133+
padding: 0;
134+
margin: 0;
135+
}
136+
137+
/* specify styles for Kanban and Toolbar container */
138+
.component_container {
139+
height: 100%;
140+
margin: 0 auto;
141+
}
142+
143+
/* specify styles for Kanban container */
144+
.widget {
145+
height: calc(100% - 56px);
146+
}
147+
~~~
148+
123149
#### Loading data
124150

125151
To add data into the Kanban, you need to provide a data set. You can create the ***data.js*** file in the ***src/*** directory and add some data into it:
@@ -221,9 +247,9 @@ export default function KanbanComponent(props) {
221247
};
222248
}, []);
223249

224-
return <div>
250+
return <div className="component_container">
225251
<div ref={toolbar_container}></div>
226-
<div ref={kanban_container} style={{ height: "calc(100% - 56px)" }}></div>
252+
<div ref={kanban_container} className="widget"></div>
227253
</div>
228254
}
229255
~~~
@@ -265,9 +291,9 @@ export default function KanbanComponent(props) {
265291
};
266292
}, []);
267293

268-
return <div>
294+
return <div className="component_container">
269295
<div ref={toolbar_container}></div>
270-
<div ref={kanban_container} style={{ height: "calc(100% - 56px)" }}></div>
296+
<div ref={kanban_container} className="widget"></div>
271297
</div>
272298
}
273299
~~~

0 commit comments

Comments
 (0)