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: convert widget into compound components #630

Merged
merged 1 commit into from
Nov 18, 2024

Conversation

tigranpetrossian
Copy link
Contributor

@tigranpetrossian tigranpetrossian commented Nov 18, 2024

Part of LEA-659

Converts the Widget into a Radix-style compound component in preparation for list item animations, but also in an attempt to standardize with other similar components like the Approver

Before

<Widget
  header={
    <WidgetHeader />
  }
>
  ...
</Widget>

After

<Widget>
  <Widget.Header>
    <Widget.Title />
  </Widget.Header>
  <Widget.Body>
    ...
  </Widget.Body>
</Widget>

This significantly reduces the prop drilling and subsequently the need to expose more props, de-couples it from ScrollView, some spacing opinions (padding, gaps, etc.), and replaces the dependency on sheet with a generic action.

Copy link

codecov bot commented Nov 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 23.72%. Comparing base (a8c0c84) to head (1de23d3).
Report is 1 commits behind head on dev.

Additional details and impacted files
@@           Coverage Diff           @@
##              dev     #630   +/-   ##
=======================================
  Coverage   23.72%   23.72%           
=======================================
  Files         165      165           
  Lines        6178     6178           
  Branches      335      335           
=======================================
  Hits         1466     1466           
  Misses       4712     4712           
Components Coverage Δ
bitcoin 62.04% <ø> (ø)
query 12.67% <ø> (ø)
utils 48.02% <ø> (ø)
crypto 68.21% <ø> (ø)
stacks 54.71% <ø> (ø)

Copy link

linear bot commented Nov 18, 2024

Copy link
Collaborator

@edgarkhanzadian edgarkhanzadian left a comment

Choose a reason for hiding this comment

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

Awesome work! 🚀

Copy link
Collaborator

@kyranjamie kyranjamie left a comment

Choose a reason for hiding this comment

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

This is a good instance of when compound components are great, thanks @tigranpetrossian

I wonder if you'd fancy writing a Coding Convention page on how we should use this pattern (and how we shouldn't).

@tigranpetrossian
Copy link
Contributor Author

This is a good instance of when compound components are great, thanks @tigranpetrossian

I wonder if you'd fancy writing a Coding Convention page on how we should use this pattern (and how we shouldn't).

Definitely! Will get to it during the week.

@tigranpetrossian tigranpetrossian added this pull request to the merge queue Nov 18, 2024
Merged via the queue into dev with commit f595166 Nov 18, 2024
11 checks passed
@tigranpetrossian tigranpetrossian deleted the refactor/widget branch November 18, 2024 12:27
@pete-watters
Copy link
Contributor

Great work @tigranpetrossian 👏

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.

4 participants