forked from elastic/eui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
cchaos
committed
Jun 19, 2018
1 parent
16189ca
commit 2cfbb8a
Showing
13 changed files
with
152 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import React, { Component, Fragment } from 'react'; | ||
|
||
import { | ||
EuiRangeStepped, | ||
} from '../../../../src/components'; | ||
|
||
import makeId from '../../../../src/components/form/form_row/make_id'; | ||
|
||
|
||
export default class extends Component { | ||
constructor(props) { | ||
super(props); | ||
|
||
const idPrefix = makeId(); | ||
|
||
this.options = [{ | ||
id: `${idPrefix}0`, | ||
value: 0, | ||
label: 'Option one', | ||
}, { | ||
id: `${idPrefix}1`, | ||
value: 1, | ||
label: 'Option two is checked by default', | ||
}, { | ||
id: `${idPrefix}2`, | ||
value: 2, | ||
label: 'Option three', | ||
}]; | ||
|
||
this.state = { | ||
value: this.options[1].value, | ||
}; | ||
} | ||
|
||
onChange = e => { | ||
this.setState({ | ||
value: e.currentTarget.value, | ||
}); | ||
}; | ||
|
||
render() { | ||
return ( | ||
<Fragment> | ||
<EuiRangeStepped | ||
options={this.options} | ||
onChange={this.onChange} | ||
value={this.state.value} | ||
/> | ||
|
||
{this.state.value} | ||
</Fragment> | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
src/components/form/range/__snapshots__/range_stepped.test.js.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`EuiRangeStepped is rendered 1`] = ` | ||
<div | ||
aria-label="aria-label" | ||
class="testClass1 testClass2" | ||
data-test-subj="test subject string" | ||
/> | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
@import 'variables'; | ||
@import 'mixins'; | ||
|
||
@import 'range'; | ||
@import 'range_stepped'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.euiRangeStepped { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export { EuiRange } from './range'; | ||
export { EuiRangeStepped } from './range_stepped'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
|
||
export const EuiRangeStepped = ({ | ||
className, | ||
children, | ||
...rest | ||
}) => ( | ||
<div className={className} {...rest}> | ||
{children} | ||
</div> | ||
); | ||
|
||
EuiRangeStepped.propTypes = { | ||
children: PropTypes.node, | ||
}; | ||
|
||
EuiRangeStepped.defaultProps = { | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import React from 'react'; | ||
import { render } from 'enzyme'; | ||
import { requiredProps } from '../../../test'; | ||
|
||
import { EuiRangeStepped } from './range_stepped'; | ||
|
||
describe('EuiRangeStepped', () => { | ||
test('is rendered', () => { | ||
const component = render( | ||
<EuiRangeStepped {...requiredProps} /> | ||
); | ||
|
||
expect(component) | ||
.toMatchSnapshot(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -128,6 +128,7 @@ export { | |
EuiRadio, | ||
EuiRadioGroup, | ||
EuiRange, | ||
EuiRangeStepped, | ||
EuiSelect, | ||
EuiSwitch, | ||
EuiTextArea, | ||
|