Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
paragon
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
paragon
Commits
a6b371b2
Commit
a6b371b2
authored
Jun 08, 2017
by
Sarah Fischmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
checkbox is setup
parent
17417b0d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
65 additions
and
0 deletions
+65
-0
src/CheckBox.jsx
+54
-0
stories/index.jsx
+11
-0
No files found.
src/CheckBox.jsx
0 → 100644
View file @
a6b371b2
import
React
from
'react'
;
import
{
Input
}
from
'reactstrap'
;
import
PropTypes
from
'prop-types'
;
import
asInput
,
{
inputProps
}
from
'./utils/asInput'
;
class
CheckBox
extends
React
.
Component
{
constructor
(
props
)
{
super
(
props
);
this
.
state
=
{
pressed
:
"false"
};
}
handleClick
()
{
if
(
this
.
state
.
pressed
==
"true"
)
{
this
.
setState
({
pressed
:
"false"
,
})
}
else
{
this
.
setState
({
pressed
:
"true"
});
}
}
render
()
{
const
props
=
{...
this
.
props
};
return
(
<
form
>
<
label
class=
"form-check-label"
>
<
input
type=
"checkbox"
class=
"form-check-input"
name=
{
props
.
name
}
aria
-
descrivedby=
{
props
.
describedby
}
aria
-
checked=
{
this
.
state
.
pressed
}
tabindex=
"0"
onClick=
{
()
=>
this
.
handleClick
()
}
/>
{
props
.
checkLabel
}
</
label
>
</
form
>
);
}
}
CheckBox
.
propTypes
=
{
...
inputProps
,
checkLabel
:
PropTypes
.
string
.
isRequired
};
export
default
CheckBox
;
stories/index.jsx
View file @
a6b371b2
...
@@ -4,6 +4,7 @@ import { storiesOf, linkTo } from '@kadira/storybook';
...
@@ -4,6 +4,7 @@ import { storiesOf, linkTo } from '@kadira/storybook';
import
TextInput
from
'../src/TextInput'
;
import
TextInput
from
'../src/TextInput'
;
import
SelectInput
from
'../src/SelectInput'
;
import
SelectInput
from
'../src/SelectInput'
;
import
CheckBox
from
'../src/CheckBox'
import
Welcome
from
'./Welcome'
;
import
Welcome
from
'./Welcome'
;
storiesOf
(
'Welcome'
,
module
)
storiesOf
(
'Welcome'
,
module
)
...
@@ -124,3 +125,13 @@ storiesOf('SelectInput', module)
...
@@ -124,3 +125,13 @@ storiesOf('SelectInput', module)
}
}
}
}
/>
/>
));
));
storiesOf
(
'CheckBox'
,
module
)
.
add
(
'basic usage'
,
()
=>
(
<
CheckBox
name=
"checkbox"
label=
"CheckBox"
describedBy=
"checkbox"
checkLabel=
"check me out"
/>
));
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment