Skip to content

Commit

Permalink
[#459] Refactor: RangeSlider로 이름 구체화
Browse files Browse the repository at this point in the history
  • Loading branch information
giwan-dev committed Feb 7, 2020
1 parent 626da50 commit 3fe6ac3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
6 changes: 3 additions & 3 deletions docs/stories/slider.stories.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useState } from 'react'
import { storiesOf } from '@storybook/react'

import Slider from '@titicaca/slider'
import { RangeSlider } from '@titicaca/slider'
import { Text } from '@titicaca/core-elements'

function Label({ fromValue, toValue }) {
Expand All @@ -19,7 +19,7 @@ storiesOf('Slider', module)
return (
<div style={{ height: '4000px', padding: '500px 20px 0 20px' }}>
컴포넌트 외부: {values.join(', ')}
<Slider
<RangeSlider
min={0}
max={500000}
onChange={setValues}
Expand All @@ -34,7 +34,7 @@ storiesOf('Slider', module)
return (
<div style={{ height: '4000px', padding: '500px 20px 0 20px' }}>
컴포넌트 외부: {values.join(', ')}
<Slider
<RangeSlider
min={0}
max={500000}
onChange={setValues}
Expand Down
1 change: 1 addition & 0 deletions packages/slider/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default as RangeSlider } from './range-slider'
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import Handle from './handle'
type SliderValue = readonly number[]
type ValueTransformer = (x: number) => number

interface SliderProps {
interface RangeSliderProps {
initialValues?: SliderValue
step?: number
min: number
Expand Down Expand Up @@ -53,15 +53,15 @@ const NON_LINEAR_FN_SET: ValueTransformer[] = [
(x) => Math.round(Math.pow(x, 1 / EXPONENT)),
]

export default function Slider({
export default function RangeSlider({
step = 1,
initialValues,
min,
max,
onChange,
labelComponent: LabelComponent,
nonLinear,
}: SliderProps) {
}: RangeSliderProps) {
const [values, setValues] = useState<SliderValue>(initialValues || [min, max])

const [scaleFn, scaleFnInverse] = nonLinear
Expand Down

0 comments on commit 3fe6ac3

Please sign in to comment.