Skip to content
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

refactor: migrate inline type to interface #54

Open
wit03 opened this issue Oct 9, 2024 · 0 comments
Open

refactor: migrate inline type to interface #54

wit03 opened this issue Oct 9, 2024 · 0 comments

Comments

@wit03
Copy link
Member

wit03 commented Oct 9, 2024

          _:hammer_and_wrench: Refactor suggestion_

Refactor Props Definition for Improved Readability

Currently, the component's props are destructured, and their types are defined separately, leading to repetition. Consider defining a DialogFilterProps interface to streamline the code and enhance maintainability.

Apply this diff to refactor the props definition:

+interface DialogFilterProps {
+  open: boolean
+  onClose: () => void
+  checkBox: CheckBoxStateType
+  handleChangeCategory: (value: string) => void
+  handleClearFilter: () => void
+  handleChangeApplicationCategory: (value: string) => void
+  handleChangePriceModel: (value: string) => void
+}
+
-export default function DialogFilter({
-  onClose,
-  open,
-  checkBox,
-  handleChangeCategory,
-  handleChangeApplicationCategory,
-  handleClearFilter,
-  handleChangePriceModel
-}: {
-  open: boolean
-  onClose: () => void
-  checkBox: CheckBoxStateType
-  handleChangeCategory: (value: string) => void
-  handleClearFilter: () => void
-  handleChangeApplicationCategory: (value: string) => void
-  handleChangePriceModel: (value: string) => void
-}) {
+export default function DialogFilter({
+  onClose,
+  open,
+  checkBox,
+  handleChangeCategory,
+  handleChangeApplicationCategory,
+  handleClearFilter,
+  handleChangePriceModel
+}: DialogFilterProps) {
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

interface DialogFilterProps {
  open: boolean
  onClose: () => void
  checkBox: CheckBoxStateType
  handleChangeCategory: (value: string) => void
  handleClearFilter: () => void
  handleChangeApplicationCategory: (value: string) => void
  handleChangePriceModel: (value: string) => void
}

export default function DialogFilter({
  onClose,
  open,
  checkBox,
  handleChangeCategory,
  handleChangeApplicationCategory,
  handleClearFilter,
  handleChangePriceModel
}: DialogFilterProps) {

Originally posted by @coderabbitai[bot] in #46 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant