-
Notifications
You must be signed in to change notification settings - Fork 10.7k
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
Create tree-control component #36432
Conversation
91112dc
to
ea0dffe
Compare
Test Results SummaryCommit SHA: e7f3bbf
To view the full API test report, click here. To view the full E2E test report, click here. To view all test reports, visit the WooCommerce Test Reports Dashboard. |
ce03195
to
e7f3bbf
Compare
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.
Beautiful work! Love how you broke down this component.
Left one minor nitpick around styling and a question about whether or not we should go ahead and export this experimental component, but pre-approving as this is 💯
function findChildren( | ||
items: Item[], | ||
parent?: Item[ 'parent' ], | ||
memo: MemoItems = {} |
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.
💯 nicely done!
|
||
return children.map( ( child ) => { | ||
const linkedTree = memo[ child.value ]; | ||
linkedTree.parent = child.parent ? memo[ child.parent ] : undefined; |
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.
🎉
|
||
export function useTreeItem( { item, level, ...props }: TreeItemProps ) { | ||
const nextLevel = level + 1; | ||
const nextHeadingPaddingLeft = ( level - 1 ) * 28 + 12; |
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.
Could we apply these styles via SCSS? This might give us more flexibility for consumers in the future.
@@ -0,0 +1,4 @@ | |||
export * from './tree'; |
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.
Minor and may not be necessary for this PR, but should we also export this under the components/src/index.ts
?
All Submissions:
Changes proposed in this Pull Request:
Partialy closes #35851
How to test the changes in this Pull Request:
http://localhost:6007/?path=/story/woocommerce-admin-experimental-treecontrol--simple-tree
Screen.Recording.2023-01-17.at.11.04.33.AM.mov
Other information:
pnpm --filter=<project> changelog add
?FOR PR REVIEWER ONLY: