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 components for improved accessibility and consistency #345

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

SanjithAnde
Copy link

@SanjithAnde SanjithAnde commented Dec 13, 2024

Export components to enhance accessibility and maintain consistency across the codebase.

Summary by Sourcery

Enhancements:

  • Refactor components to export them directly, improving accessibility and consistency across the codebase.

@SanjithAnde SanjithAnde linked an issue Dec 13, 2024 that may be closed by this pull request
Copy link
Contributor

sourcery-ai bot commented Dec 13, 2024

Reviewer's Guide by Sourcery

This PR refactors component exports across multiple files to improve code consistency and accessibility. The main change involves standardizing how components are exported by using direct named exports instead of collecting exports at the bottom of files. This makes the code more maintainable and follows modern JavaScript/TypeScript best practices.

Class diagram for refactored component exports

classDiagram
    class CardTop {
        +useNode()
    }
    class Card {
        +useNode()
        +theme.useToken()
    }
    class AhpIdFormConfirmationTop {
        +useNode()
    }
    class AhpIdFormConfirmation {
        +useNode()
    }
    class MenuComponent {
        +antdTheme.useToken()
    }
    class AhpIdFormTop {
        +useNode()
    }
    class AhpIdForm {
        +useNode()
    }
    class AhpPaymentRequestFormTop {
        +useNode()
    }
    class AhpPaymentRequestForm {
        +useNode()
    }
    class AhpRequestFeedbackFormTop {
        +useNode()
    }
    class AhpRequestFeedbackForm {
        +useNode()
    }
    class AhpSendMoneyFormTop {
        +useNode()
    }
    class AhpSendMoneyForm {
        +useNode()
    }
    class Breadcrumbs {
        +usePageLayouts()
    }
    class Container {
        +useNode()
    }
    class Footer {
        +theme.useToken()
    }
    class PropertyDetails {
        +useParams()
    }
    class TextComponent {
        +useNode()
    }
    class TextThing {
        +useNode()
    }
    class CountryInfo2 {
        +theme.useToken()
    }
    class ImageComponent {
        +useNode()
    }
    class PropertiesListing {
        +theme.useToken()
    }
    class Grid {
        +useNode()
    }
    class SiteEditorFiles {
        +useParams()
    }
    class SiteEditorPageEditor {
        +theme.useToken()
    }
    class SiteEditorPageTree {
        +usePageLayouts()
    }
Loading

File-Level Changes

Change Details Files
Standardize component exports across the codebase
  • Replace bottom-of-file exports with direct named exports
  • Remove redundant variable declarations before component definitions
  • Clean up unnecessary export blocks
ui-community/src/components/editor/components/card.tsx
ui-community/src/components/editor/components/menu-component.tsx
ui-community/src/components/editor/components/container.tsx
ui-community/src/components/editor/components/footer.tsx
ui-community/src/components/editor/components/text-component.tsx
ui-community/src/components/editor/components/text-thing.tsx
ui-community/src/components/editor/components/image-component.tsx
ui-community/src/components/editor/components/grid.tsx
Refactor form component exports
  • Convert to direct named exports for form components
  • Add export keywords to form-related component declarations
ui-community/src/components/editor/components/ahp-id-form.tsx
ui-community/src/components/editor/components/ahp-id-form-confirmation.tsx
ui-community/src/components/editor/components/ahp-payment-request-form.tsx
ui-community/src/components/editor/components/ahp-request-feedback-form.tsx
ui-community/src/components/editor/components/ahp-send-money-form.tsx
Update page and layout component exports
  • Standardize exports in admin pages
  • Remove default exports in favor of named exports
  • Clean up redundant export statements
ui-community/src/components/layouts/admin/pages/site-editor-files.tsx
ui-community/src/components/layouts/admin/pages/site-editor-page-editor.tsx
ui-community/src/components/layouts/admin/pages/site-editor-page-tree.tsx
ui-community/src/components/layouts/admin/components/site-editor-files-list.tsx

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @SanjithAnde - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟡 Review instructions: 3 issues found
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

let Card: any;

Card = () => {
export const Card = () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (review_instructions): Missing CardProps interface for the Card component

Please define a CardProps interface for the component's props according to 002-ui-tsx-files.md

Review instructions:

Path patterns: ui-*/**/*.tsx

Instructions:
An interface or type should be defined for the component's props, named Props.



const CardTop = (props: any) => {
export const CardTop = (props: any) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (review_instructions): Props should be typed with CardTopProps interface instead of any

Please define a CardTopProps interface for the component's props according to 002-ui-tsx-files.md

Review instructions:

Path patterns: ui-*/**/*.tsx

Instructions:
An interface or type should be defined for the component's props, named Props.


MenuComponent = ({ theme, ...props } : TextProp) => {
export const MenuComponent = ({ theme, ...props } : TextProp) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (review_instructions): Props interface should be named MenuComponentProps instead of TextProp

Please rename the TextProp interface to MenuComponentProps according to 002-ui-tsx-files.md

Review instructions:

Path patterns: ui-*/**/*.tsx

Instructions:
An interface or type should be defined for the component's props, named Props.

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

Successfully merging this pull request may close these issues.

Remove default exports in react components
3 participants