Skip to content

Commit

Permalink
feat(components): add Range form component
Browse files Browse the repository at this point in the history
  • Loading branch information
stuf committed Oct 11, 2019
1 parent 05ab2a9 commit 18f370e
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/components/form/Range/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
export interface Tick {
label: string;
value: number;
}

export interface Props {
tickStart: Tick;
tickEnd: Tick;
value: number;
min: number;
max: number;
step: number;
onChange(ev: InputEvent): void;
}
18 changes: 18 additions & 0 deletions src/components/form/Range/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/* eslint no-unused-vars: [1, {"varsIgnorePattern": "[K|T]"}] */
import * as React from 'karet';
import * as U from 'karet.util';

import * as T from './index.d';

/**
* @param {T.Props} props
*/
function Range({ value, min, max, step, onChange }) {
return (
<div>
<U.Input {...{ type: 'range', value, min, max, step, onChange }} />
</div>
);
}

export default Range;
8 changes: 8 additions & 0 deletions src/components/form/Range/index.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import * as React from 'karet';
import { shallow } from 'enzyme';

import Range from './index';

it('renders without crashing', () => {
shallow(<Range />);
});

0 comments on commit 18f370e

Please sign in to comment.