Skip to content

Commit 31d8247

Browse files
Mariela TihovaMariela Tihova
authored andcommitted
Update Switch samples for React19
1 parent 65ed803 commit 31d8247

4 files changed

Lines changed: 32 additions & 64 deletions

File tree

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,18 @@
11
import React from 'react';
22
import ReactDOM from 'react-dom/client';
33
import './index.css';
4-
import { IgrSwitch, IgrSwitchModule } from 'igniteui-react';
4+
import { IgrSwitch } from 'igniteui-react';
55
import 'igniteui-webcomponents/themes/light/bootstrap.css';
66

7-
IgrSwitchModule.register();
7+
export default function SwitchOutlined() {
88

9-
export default class SwitchOutlined extends React.Component<any, any> {
10-
11-
constructor(props: any) {
12-
super(props);
13-
}
14-
15-
public render(): JSX.Element {
16-
return (
17-
<div className="container sample">
18-
<IgrSwitch checked={true} ><span>Label</span></IgrSwitch>
19-
</div>
20-
);
21-
}
9+
return (
10+
<div className="container sample">
11+
<IgrSwitch checked={true} ><span>Label</span></IgrSwitch>
12+
</div>
13+
);
2214
}
2315

24-
// rendering above class to the React DOM
16+
// rendering above component to the React DOM
2517
const root = ReactDOM.createRoot(document.getElementById('root'));
2618
root.render(<SwitchOutlined/>);
Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,18 @@
11
import React from 'react';
22
import ReactDOM from 'react-dom/client';
33
import './index.css';
4-
import { IgrSwitch, IgrSwitchModule } from 'igniteui-react';
4+
import { IgrSwitch } from 'igniteui-react';
55
import 'igniteui-webcomponents/themes/light/bootstrap.css';
66

7-
IgrSwitchModule.register();
7+
export default function SwitchDisabled() {
88

9-
export default class SwitchDisabled extends React.Component<any, any> {
10-
11-
constructor(props: any) {
12-
super(props);
13-
}
14-
15-
public render(): JSX.Element {
16-
return (
17-
<div className="container sample">
18-
<IgrSwitch disabled={true} />
19-
</div>
20-
);
21-
}
9+
return (
10+
<div className="container sample">
11+
<IgrSwitch disabled={true} />
12+
</div>
13+
);
2214
}
2315

24-
// rendering above class to the React DOM
16+
// rendering above component to the React DOM
2517
const root = ReactDOM.createRoot(document.getElementById('root'));
2618
root.render(<SwitchDisabled/>);
Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,18 @@
11
import React from 'react';
22
import ReactDOM from 'react-dom/client';
33
import './index.css';
4-
import { IgrSwitch, IgrSwitchModule } from 'igniteui-react';
4+
import { IgrSwitch } from 'igniteui-react';
55
import 'igniteui-webcomponents/themes/light/bootstrap.css';
66

7-
IgrSwitchModule.register();
7+
export default function SwitchLabel() {
88

9-
export default class SwitchLabel extends React.Component<any, any> {
10-
11-
constructor(props: any) {
12-
super(props);
13-
}
14-
15-
public render(): JSX.Element {
16-
return (
17-
<div className="sample">
18-
<IgrSwitch aria-labelledby="switchLabel" labelPosition="before" ><span id="switch-label">Label</span></IgrSwitch>
19-
</div>
20-
);
21-
}
9+
return (
10+
<div className="sample">
11+
<IgrSwitch aria-labelledby="switchLabel" labelPosition="before"><span id="switch-label">Label</span></IgrSwitch>
12+
</div>
13+
);
2214
}
2315

24-
// rendering above class to the React DOM
16+
// rendering above component to the React DOM
2517
const root = ReactDOM.createRoot(document.getElementById('root'));
2618
root.render(<SwitchLabel/>);
Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,18 @@
11
import React from 'react';
22
import ReactDOM from 'react-dom/client';
33
import './index.css';
4-
import { IgrSwitch, IgrSwitchModule } from 'igniteui-react';
4+
import { IgrSwitch } from 'igniteui-react';
55
import 'igniteui-webcomponents/themes/light/bootstrap.css';
66

7-
IgrSwitchModule.register();
7+
export default function SwitchOverview() {
88

9-
export default class SwitchOverview extends React.Component<any, any> {
10-
11-
constructor(props: any) {
12-
super(props);
13-
}
14-
15-
public render(): JSX.Element {
16-
return (
17-
<div className="container sample">
18-
<IgrSwitch></IgrSwitch>
19-
</div>
20-
);
21-
}
9+
return (
10+
<div className="container sample">
11+
<IgrSwitch></IgrSwitch>
12+
</div>
13+
);
2214
}
2315

24-
// rendering above class to the React DOM
16+
// rendering above component to the React DOM
2517
const root = ReactDOM.createRoot(document.getElementById('root'));
2618
root.render(<SwitchOverview/>);

0 commit comments

Comments
 (0)