-
-
Notifications
You must be signed in to change notification settings - Fork 53
Code improvements - 13 jan #1674
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,7 +12,7 @@ export default { | |
| </div> | ||
|
|
||
| </SandboxEditor> | ||
| }; | ||
| } as any; | ||
|
|
||
| export const All = { | ||
| args: { | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,15 +1,15 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 'use client'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import React from 'react'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import StepsContext from '../context/StepsContext'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { useStepsContext } from '../context/StepsContext'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import clsx from 'clsx'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| type StepItemProps = React.HTMLAttributes<HTMLDivElement> & { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| value?: string | null; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| value?: string | number | null; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const StepItem = ({ children, value = null, className = '', ...props }: StepItemProps) => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const { rootClass, currentStep, setCurrentStep } = React.useContext(StepsContext); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const { rootClass, currentStep, setCurrentStep } = useStepsContext(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return <div className={clsx(`${rootClass}-item`, className)} {...props}>{children}</div>; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
11
to
14
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unused variables: The component destructures Suggested optionsOption 1: If these are needed for future implementation, add a TODO comment: const StepItem = ({ children, value = null, className = '', ...props }: StepItemProps) => {
- const { rootClass, currentStep, setCurrentStep } = useStepsContext();
+ const { rootClass } = useStepsContext();
+ // TODO: Implement step selection using value, currentStep, and setCurrentStep
return <div className={clsx(`${rootClass}-item`, className)} {...props}>{children}</div>;
};Option 2: If these are intended to be used now, implement the step logic: const StepItem = ({ children, value = null, className = '', ...props }: StepItemProps) => {
const { rootClass, currentStep, setCurrentStep } = useStepsContext();
- return <div className={clsx(`${rootClass}-item`, className)} {...props}>{children}</div>;
+ const isActive = value === currentStep;
+ return (
+ <div
+ className={clsx(`${rootClass}-item`, { [`${rootClass}-item-active`]: isActive }, className)}
+ onClick={() => value !== null && setCurrentStep(value)}
+ {...props}
+ >
+ {children}
+ </div>
+ );
};📝 Committable suggestion
Suggested change
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| import { customClassSwitcher } from './customClassSwitcher'; | ||
| import { composeRefs, mergeProps } from './utils/mergeProps'; | ||
|
|
||
| export { customClassSwitcher }; | ||
| export { customClassSwitcher, composeRefs, mergeProps }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PriceRangeSlider story uses incorrect default values
Low Severity
The
PriceRangeSliderstory'sdefaultValuewas changed from[100, 500]to[25, 75], and thearia-labelfrom "Price range" to "Range slider". Since this slider hasmin={0}andmax={1000}with price marks at $0 through $1000, the original values representing a $100-$500 range made sense. The new values[25, 75]appear to be mistakenly copied from the basicRangeSliderstory and don't represent meaningful prices in this context.