Skip to content

Commit c1bd216

Browse files
committed
refactor(Switches): move to AppSwitch component
1 parent fbad174 commit c1bd216

File tree

3 files changed

+338
-512
lines changed

3 files changed

+338
-512
lines changed

src/containers/Full/FullAside.js

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React, { Component } from 'react';
22
import { Input, Label, Nav, NavItem, NavLink, Progress, TabContent, TabPane, ListGroup, ListGroupItem } from 'reactstrap';
33
import PropTypes from 'prop-types';
44
import classNames from 'classnames';
5+
import { AppSwitch } from '@coreui/react'
56

67
const propTypes = {
78
children: PropTypes.node,
@@ -239,11 +240,7 @@ class FullAside extends Component {
239240
<div className="aside-options">
240241
<div className="clearfix mt-4">
241242
<small><b>Option 1</b></small>
242-
<Label className="switch switch-text switch-pill switch-success switch-sm float-right">
243-
<Input type="checkbox" className="switch-input" defaultChecked />
244-
<span className="switch-label" data-on="On" data-off="Off"></span>
245-
<span className="switch-handle"></span>
246-
</Label>
243+
<AppSwitch className={'float-right'} variant={'pill'} label color={'success'} defaultChecked size={'sm'}/>
247244
</div>
248245
<div>
249246
<small className="text-muted">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
@@ -255,11 +252,7 @@ class FullAside extends Component {
255252
<div className="aside-options">
256253
<div className="clearfix mt-3">
257254
<small><b>Option 2</b></small>
258-
<Label className="switch switch-text switch-pill switch-success switch-sm float-right">
259-
<Input type="checkbox" className="switch-input" />
260-
<span className="switch-label" data-on="On" data-off="Off"></span>
261-
<span className="switch-handle"></span>
262-
</Label>
255+
<AppSwitch className={'float-right'} variant={'pill'} label color={'success'} size={'sm'}/>
263256
</div>
264257
<div>
265258
<small className="text-muted">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
@@ -271,22 +264,17 @@ class FullAside extends Component {
271264
<div className="aside-options">
272265
<div className="clearfix mt-3">
273266
<small><b>Option 3</b></small>
274-
<Label className="switch switch-text switch-pill switch-success switch-sm float-right">
275-
<Input type="checkbox" className="switch-input" />
276-
<span className="switch-label" data-on="On" data-off="Off"></span>
277-
<span className="switch-handle"></span>
278-
</Label>
267+
<AppSwitch className={'float-right'} variant={'pill'} label color={'success'} defaultChecked size={'sm'} disabled/>
268+
<div>
269+
<small className="text-muted">Option disabled.</small>
270+
</div>
279271
</div>
280272
</div>
281273

282274
<div className="aside-options">
283275
<div className="clearfix mt-3">
284276
<small><b>Option 4</b></small>
285-
<Label className="switch switch-text switch-pill switch-success switch-sm float-right">
286-
<Input type="checkbox" className="switch-input" defaultChecked />
287-
<span className="switch-label" data-on="On" data-off="Off"></span>
288-
<span className="switch-handle"></span>
289-
</Label>
277+
<AppSwitch className={'float-right'} variant={'pill'} label color={'success'} defaultChecked size={'sm'} />
290278
</div>
291279
</div>
292280

src/views/Base/Cards/Cards.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React, { Component } from 'react';
22
import { Badge, Card, CardBody, CardFooter, CardHeader, Col, Input, Label, Row, Collapse, Fade } from 'reactstrap';
3+
import { AppSwitch } from '@coreui/react'
34

45
class Cards extends Component {
56
constructor(props) {
@@ -64,11 +65,7 @@ class Cards extends Component {
6465
<Card>
6566
<CardHeader>
6667
Card with switch
67-
<Label className="switch switch-sm switch-text switch-info float-right mb-0">
68-
<Input type="checkbox" className="switch-input" />
69-
<span className="switch-label" data-on="On" data-off="Off"></span>
70-
<span className="switch-handle"></span>
71-
</Label>
68+
<AppSwitch className={'float-right mb-0'} label color={'info'} defaultChecked size={'sm'}/>
7269
</CardHeader>
7370
<CardBody>
7471
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut

0 commit comments

Comments
 (0)