From 5bd038f2cc051228a9c9e3a612b129b739c971ac Mon Sep 17 00:00:00 2001 From: Navin Date: Mon, 19 Oct 2020 18:44:33 +0530 Subject: [PATCH] =?UTF-8?q?refactor(progress):=20=E2=99=BB=EF=B8=8F=20=20u?= =?UTF-8?q?pdate=20stories=20&=20component?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/progress/Progress.ts | 7 +++---- src/progress/stories/LinearProgress.stories.tsx | 2 +- .../stories/{Progress.tsx => ProgressComponent.tsx} | 0 3 files changed, 4 insertions(+), 5 deletions(-) rename src/progress/stories/{Progress.tsx => ProgressComponent.tsx} (100%) diff --git a/src/progress/Progress.ts b/src/progress/Progress.ts index 147c66a36..74ab3b60a 100644 --- a/src/progress/Progress.ts +++ b/src/progress/Progress.ts @@ -4,13 +4,12 @@ * We improved the Progress Component [Progress](https://github.com/chakra-ui/chakra-ui/tree/develop/packages/progress) * to work with Reakit System */ -import { isFunction } from "@chakra-ui/utils"; import { BoxHTMLProps, BoxOptions, useBox } from "reakit"; import { createHook, createComponent } from "reakit-system"; +import { dataAttr } from "../utils"; import { PROGRESS_KEYS } from "./__keys"; import { ProgressStateReturn } from "./ProgressState"; -import { dataAttr } from "../utils"; export type ProgressOptions = BoxOptions & Pick< @@ -39,8 +38,8 @@ export const useProgress = createHook({ const getAriaValueText = () => { if (value == null) return; - return isFunction(options.getAriaValueText) - ? options.getAriaValueText(value, percent) + return options.getAriaValueText + ? options.getAriaValueText?.(value, percent) : ariaValueText ?? `${value}`; }; diff --git a/src/progress/stories/LinearProgress.stories.tsx b/src/progress/stories/LinearProgress.stories.tsx index c4287fbc8..ec911bba9 100644 --- a/src/progress/stories/LinearProgress.stories.tsx +++ b/src/progress/stories/LinearProgress.stories.tsx @@ -1,7 +1,7 @@ import React from "react"; import { Meta } from "@storybook/react"; -import { StyledProgress } from "./Progress"; +import { StyledProgress } from "./ProgressComponent"; export default { title: "Progress/Linear", diff --git a/src/progress/stories/Progress.tsx b/src/progress/stories/ProgressComponent.tsx similarity index 100% rename from src/progress/stories/Progress.tsx rename to src/progress/stories/ProgressComponent.tsx