Skip to content

Commit 7ed7307

Browse files
committed
updates for v1.0.0
1 parent 3ee6d80 commit 7ed7307

File tree

6 files changed

+710
-50
lines changed

6 files changed

+710
-50
lines changed

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7-
## [1.0.0-beta.11] - 2019-04-01
7+
## [1.0.0] - 2019-04-03
88
### Added
9-
- New test folder with demo page and height-test
9+
- New demo/api page (test folder) and a new height-test page
1010
### Changed
1111
- Fixed issue with component height not matching bootstrap components
1212
- Added "keywords" and "bugs" to `package.json`

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "bootstrap-switch-button-react",
3-
"version": "1.0.0-beta.11",
3+
"version": "1.0.0",
44
"license": "MIT",
55
"repository": {
66
"type": "git",

test/index.html

Lines changed: 149 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
background-size: 256px 256px;
1515
}
1616

17-
footer {
18-
text-align: center;
17+
#demos .row .switch.btn {
18+
margin-right: 1rem!important; /* mr-3 */
1919
}
2020
</style>
2121
</head>
@@ -34,18 +34,13 @@
3434
<li class="nav-item">
3535
<a class="nav-link" href="#installation">Installation</a>
3636
</li>
37+
<li class="nav-item"><a class="nav-link d-none d-sm-none d-md-block" href="#usage">Usage</a></li>
3738
<li class="nav-item">
3839
<a class="nav-link" href="#demos">Demos</a>
3940
</li>
40-
<li class="nav-item">
41-
<a class="nav-link d-none d-sm-none d-md-block" href="#usage">Usage</a>
42-
</li>
4341
<li class="nav-item">
4442
<a class="nav-link d-none d-sm-none d-md-block" href="#api">API</a>
4543
</li>
46-
<li class="nav-item">
47-
<a class="nav-link d-none d-sm-none d-md-block" href="#events">Events</a>
48-
</li>
4944
<li class="nav-item">
5045
<a class="nav-link" href="https://github.com/gitbrent/bootstrap-switch-button-react/">GitHub</a>
5146
</li>
@@ -56,43 +51,50 @@
5651
</div>
5752
</nav>
5853
<div class="mast-head">
59-
<div class="container">
60-
<h1>Bootstrap Switch Button for React</h1>
61-
<p>
62-
<strong>Bootstrap Switch Button</strong> is a component to use instead of plain checkboxes for responsive switch buttons. </p>
54+
<div class="container my-3">
55+
<div class="row align-items-center">
56+
<div class="col-auto">
57+
<i class="fab fa-react" style="font-size:5rem"></i>
58+
</div>
59+
<div class="col">
60+
<h1>Bootstrap Switch Button for React</h1>
61+
<p class="mb-0">
62+
<strong>Bootstrap Switch Button</strong> is a component to use instead of plain checkboxes for responsive switch buttons.
63+
</p>
64+
</div>
65+
</div>
6366
</div>
6467
</div>
6568
</header>
6669
<main>
67-
<section id="updated" class="container my-5">
68-
<div class="alert alert-success" role="alert">
69-
<h3 class="alert-heading">Made for Bootstrap 4!</h3>
70-
<h6 class="font-weight-light"> This page and all of the switch buttons shown are running on Bootstrap 4.3.x </h6>
70+
<section id="features" class="container my-5">
71+
<div class="alert alert-secondary" role="alert">
72+
<h3 class="alert-heading text-dark">Made for Bootstrap 4!</h3>
7173
<hr />
7274
<div class="row">
7375
<div class="col-12 col-md-4 mb-1 mb-md-0">
7476
<div class="row align-items-center">
7577
<div class="col-2 p-0 p-md-2 text-right">
76-
<i class="fas fa-check-circle text-success d-none d-sm-none d-md-none d-lg-block" style="font-size:48px"></i>
77-
<i class="fas fa-check-circle text-success d-block d-sm-block d-md-block d-lg-none " style="font-size:24px"></i>
78+
<i class="fas fa-check-circle text-info d-none d-sm-none d-md-none d-lg-block" style="font-size:36px"></i>
79+
<i class="fas fa-check-circle text-info d-block d-sm-block d-md-block d-lg-none " style="font-size:24px"></i>
7880
</div>
79-
<div class="col-10">Supports touch events</div>
81+
<div class="col-10">Easy webpack integration</div>
8082
</div>
8183
</div>
8284
<div class="col-12 col-md-4 mb-1 mb-md-0">
8385
<div class="row align-items-center">
8486
<div class="col-2 p-0 p-md-2 text-right">
85-
<i class="fas fa-check-circle text-success d-none d-sm-none d-md-none d-lg-block" style="font-size:48px"></i>
86-
<i class="fas fa-check-circle text-success d-block d-sm-block d-md-block d-lg-none " style="font-size:24px"></i>
87+
<i class="fas fa-check-circle text-info d-none d-sm-none d-md-none d-lg-block" style="font-size:36px"></i>
88+
<i class="fas fa-check-circle text-info d-block d-sm-block d-md-block d-lg-none " style="font-size:24px"></i>
8789
</div>
88-
<div class="col-10">Supports outline colors</div>
90+
<div class="col-10">Supports touch events</div>
8991
</div>
9092
</div>
9193
<div class="col-12 col-md-4 mb-1 mb-md-0">
9294
<div class="row align-items-center">
9395
<div class="col-2 p-0 p-md-2 text-right">
94-
<i class="fas fa-check-circle text-success d-none d-sm-none d-md-none d-lg-block" style="font-size:48px"></i>
95-
<i class="fas fa-check-circle text-success d-block d-sm-block d-md-block d-lg-none " style="font-size:24px"></i>
96+
<i class="fas fa-check-circle text-info d-none d-sm-none d-md-none d-lg-block" style="font-size:36px"></i>
97+
<i class="fas fa-check-circle text-info d-block d-sm-block d-md-block d-lg-none " style="font-size:24px"></i>
9698
</div>
9799
<div class="col-10">Includes a mini (-xs) size</div>
98100
</div>
@@ -108,15 +110,136 @@ <h3 class="text-secondary mt-4">NPM</h3>
108110
<h3 class="text-secondary mt-4">Yarn</h3>
109111
<pre><code class="language-bash">yarn install bootstrap-switch-button-react</code></pre>
110112
</section>
113+
114+
<section id="usage" class="container my-5 d-none d-sm-none d-md-block">
115+
<h2>Usage</h2>
116+
<hr>
117+
<p>Keep <code>state</code> in sync using the <code>onChange</code> funcion property</p>
118+
<pre><code class="language-ts">
119+
import BootstrapSwitchButton from 'bootstrap-switch-button-react'
120+
121+
&lt;BootstrapSwitchButton
122+
checked={false}
123+
onlabel='Admin User'
124+
offlabel='Regular User'
125+
onChange={(checked: boolean) => {
126+
this.setState({ isUserAdmin: checked })
127+
}}
128+
/&gt;
129+
</code></pre>
130+
</setion>
131+
132+
<!-- React injection -->
111133
<div id="root"></div>
134+
<!-- ^^^ -->
135+
112136
<section id="api" class="container my-5 d-none d-sm-none d-md-block">
113137
<h2>API</h2>
114138
<hr />
139+
140+
<h3 class="text-secondary mt-4">Component Props</h3>
141+
<div class="table-responsive">
142+
<table class="table table-striped table-condensed">
143+
<thead>
144+
<tr>
145+
<th>Name</th>
146+
<th>Type</th>
147+
<th>Default</th>
148+
<th>Description</th>
149+
</tr>
150+
</thead>
151+
<tbody>
152+
<tr>
153+
<td><code>onlabel</code></td>
154+
<td class="text-nowrap">string | html</td>
155+
<td><code>"On"</code></td>
156+
<td>Text of the <em>on</em> switch button label.</td>
157+
</tr>
158+
<tr>
159+
<td><code>offlabel</code></td>
160+
<td>string | html</td>
161+
<td><code>"Off"</code></td>
162+
<td>Text of the <em>off</em> switch button label.</td>
163+
</tr>
164+
<tr>
165+
<td><code class="text-nowrap">onstyle</code></td>
166+
<td>string</td>
167+
<td><code class="text-nowrap">"primary"</code></td>
168+
<td>
169+
Style of the <em>on</em> switch button.<br>Possible values are:
170+
<code>primary</code>, <code>secondary</code>, <code>success</code>, <code>danger</code>, <code>warning</code>, <code>info</code>, <code>light</code>, <code>dark</code><br>
171+
</td>
172+
</tr>
173+
<tr>
174+
<td><code class="text-nowrap">offstyle</code></td>
175+
<td>string</td>
176+
<td><code class="text-nowrap">"light"</code></td>
177+
<td>
178+
Style of the <em>off</em> switch button.<br>Possible values are:
179+
<code>primary</code>, <code>secondary</code>, <code>success</code>, <code>danger</code>, <code>warning</code>, <code>info</code>, <code>light</code>, <code>dark</code><br>
180+
</td>
181+
</tr>
182+
<tr>
183+
<td><code>checked<code></td>
184+
<td>boolean</td>
185+
<td><em>false</em></td>
186+
<td>
187+
Whether the switch button is "checked" (On)
188+
</td>
189+
</tr>
190+
<tr>
191+
<td><code>disabled<code></td>
192+
<td>boolean</td>
193+
<td><em>false</em></td>
194+
<td>
195+
Whether the switch button is disabled
196+
</td>
197+
</tr>
198+
<tr>
199+
<td><code>size<code></td>
200+
<td>string</td>
201+
<td><em>null</em></td>
202+
<td>
203+
Size of the switch button. If set to <em>null</em>, button is default/normal size.<br>
204+
Possible values are:
205+
<code>lg</code>, <code>sm</code>, <code>xs</code><br>
206+
</td>
207+
</tr>
208+
<tr>
209+
<td><code>style</code></td>
210+
<td>string</td>
211+
<td><em>null</em></td>
212+
<td>
213+
Appends the provided value to the switch button's class attribute.
214+
Use this to apply custom styles to the switch button.
215+
</td>
216+
</tr>
217+
<tr>
218+
<td><code>width</code></td>
219+
<td>integer</td>
220+
<td><em>null</em></td>
221+
<td>
222+
Sets the width of the switch button.<br>
223+
If set to <em>null</em>, width will be calculated.
224+
</td>
225+
</tr>
226+
<tr>
227+
<td><code>height</code></td>
228+
<td>integer</td>
229+
<td><em>null</em></td>
230+
<td>
231+
Sets the height of the switch button.<br>
232+
If set to <em>null</em>, height will be calculated.
233+
</td>
234+
</tr>
235+
</tbody>
236+
</table>
237+
</div>
115238
</section>
116239
</main>
117240
<footer class="bg-light border-top p-4">
118-
<div class="container">
119-
<h4 class="font-weight-light"> Created by <a href="https://github.com/gitbrent" target="_blank">Brent Ely</a> | Available on <a href="https://github.com/gitbrent/bootstrap-switch-button-react" target_"blank">GitHub</a> | Licensed <a href="https://github.com/gitbrent/bootstrap-switch-button-react/blob/master/LICENSE" target_"blank">MIT</a>
241+
<div class="container text-center">
242+
<h4 class="font-weight-light"> Author <a href="https://github.com/gitbrent" target="_blank">Brent Ely</a> | Available on <a href="https://github.com/gitbrent/bootstrap-switch-button-react" target_"blank">GitHub</a> | Licensed <a href="https://github.com/gitbrent/bootstrap-switch-button-react/blob/master/LICENSE" target_"blank">MIT</a>
120243
</h4>
121244
<p class="mt-4 mb-0">
122245
<iframe src="https://ghbtns.com/github-btn.html?user=gitbrent&repo=bootstrap-switch-button-react&type=fork&count=true&size=large" frameborder="0" scrolling="0" width="158px" height="30px"></iframe>

0 commit comments

Comments
 (0)