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

TreeView left margin override support #2338

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

fredvisser
Copy link
Contributor

@fredvisser fredvisser commented Aug 8, 2024

Pull Request

🀨 Rationale

The "sl-details-panel spacing tweaks" AzDO PR highlights the need to have icons start 16px from the edge, to bring all elements into alignment.

Screenshot 2024-08-09 at 3 21 01β€―PM

πŸ‘©β€πŸ’» Implementation

  • Update tree-item and anchor-tree-item to change the content-region left-padding from 10px to mediumPadding (8px) to align with standard layout grids.
  • Add treeViewPaddingLeftSize token, so that this value can be overridden by client apps that need a larger margin
  • Fixed a few .mdx Stories where the description was poorly formatted

πŸ§ͺ Testing

  • Storybook review
  • Chromatic diffs

βœ… Checklist

  • I have updated the project documentation to reflect my changes or determined no changes are needed.

@fredvisser fredvisser marked this pull request as ready for review August 9, 2024 20:23
@@ -0,0 +1,7 @@
{
Copy link
Member

@rajsite rajsite Aug 12, 2024

Choose a reason for hiding this comment

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

To summarize the concerns from Friday, the direction I think we should go is that the tree in nimble uses more normal padding values. If we look at a tree view expander aligned above a normal icon button you see the following:
image

You can see the left-padding on the tree-view is too big (10px). Normally we would expect 8px left spacing-16px icon-8px spacing. So the issue with the nimble tree-view is that padding-left should be 8px and not 10 or 12 px.

The second step is that the systemlink header seems to be using a non-standard icon button with custom sizing. It does not have a square 32px by 32px shape and seems to be a one-off unique button. The tree-view in nimble should not be adjusted to the sizing of that unique button only used in the sl-header.

Instead if we need to override this padding for one unique use-case then it should just be done in the sl-header styles or at most we create a design token that can be configured externally.

@fredvisser fredvisser changed the title Increase tree expander margin from 10px to 16px TreeView left margin override support Aug 13, 2024
Comment on lines +205 to +209
leftMargin: {
name: 'Left margin',
description: 'Overrides the default left margin of the tree view.',
table: { category: apiCategory.styles },
control: { type: 'text' }
Copy link
Member

Choose a reason for hiding this comment

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

I think having the token for configuration of this property is the right move but I don't know about broadcasting this so openly in the args table.

We could call it out in usage guidance in the mdx for the very specific use case. And we should have a test for the behavior. I'm actually tempted to have it as part of the matrix test to make sure it is interacting well with all the other modes that impact the spacing there (nested menu-items, icons, etc. )

Copy link
Contributor Author

Choose a reason for hiding this comment

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

How about a compromise where we remove the docs from the args table and rely on the SWIF Chromatic tests to catch any regressions, instead of adding this to the matrix tests?

Copy link
Member

Choose a reason for hiding this comment

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

I'd like nimble features to have tests in nimble. I wouldn't expect adding a new state to the matrix test to be difficult.
If don't want to bloat the current test matrix can split the dimension out into a separate test pretty easily.
If don't think it's worth testing against the full matrix can make a separate matrix test for the relevant permutations.

Copy link
Member

Choose a reason for hiding this comment

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

Moving the PR back to draft until we decide on the testing direction

@rajsite rajsite marked this pull request as draft September 3, 2024 16:58
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.

3 participants