Skip to content
This repository has been archived by the owner on May 24, 2024. It is now read-only.

[terra-folder-tree] Base Component Creation #1888

Merged
merged 15 commits into from
Nov 21, 2023
Merged

[terra-folder-tree] Base Component Creation #1888

merged 15 commits into from
Nov 21, 2023

Conversation

sycombs
Copy link
Contributor

@sycombs sycombs commented Nov 14, 2023

Summary

The PR adds the terra-folder-tree base component, which displays items in a hierarchical folder structure. Keyboard navigation and expand/collapse functionality are not included in this PR and will be implemented as part of a future Jira.

Testing

This change was tested using:

  • WDIO
  • Jest
  • Visual testing (please attach a screenshot or recording)
  • Other (please describe below)
  • No tests are needed

Reviews

In addition to engineering reviews, this PR needs:

  • UX review
  • Accessibility review
  • Functional review

Additional Details

This PR resolves:

UXPLATFORM-9679


Thank you for contributing to Terra.
@cerner/terra

/**
* The heading level for the title of the folder tree.
*/
headerLevel: PropTypes.number,
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this a value that we want to be configurable or should it be a constant value for all FolderTree components.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Talked with @eawww, we want to keep the header level configurable since we don't know where on a page FolderTree will be used so consumers will need the option to set custom heading levels.

onClick={onClick}
/>
{/* eslint-disable-next-line react/forbid-dom-props */}
<span style={{ paddingLeft: `${level}rem` }}>
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are we adding a span element around the Terra Arrange? Are we trying to use this like the Spacer component?

<span style={{ paddingLeft: `${level}rem` }}>
<Arrange
fitStart={(
<Spacer paddingLeft="medium" paddingRight="medium" isInlineBlock>
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like we are using both a span and Spacer element to add padding.

display: flex;
margin: 0;
min-height: var(--terra-folder-tree-item-min-height, 2.92857rem);
overflow-wrap: anywhere;
Copy link
Contributor

Choose a reason for hiding this comment

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

We would want this to be "break-word". I don't think we want to use anywhere as our option.

https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-wrap

Copy link
Contributor Author

Choose a reason for hiding this comment

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

With break-word, long strings without spaces do not wrap which is why I used anywhere, do you know of a way to handle that with break-word?

image

:local {
.folder-tree-item {
align-items: center;
background-color: var(--terra-folder-tree-item-background-color, #fff);
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it is better to use background instead of background-color. The background style would allow for both colors and gradients without a future style change.

.selected {
background-color: var(--terra-folder-tree-item-selected-background-color, darken(#ebf6fd, 2%));
}

Copy link
Contributor

Choose a reason for hiding this comment

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

What about the focus state?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The focus state should be added with keyboard navigation (UXPLATFORM-9776).

:local {
.orion-fusion-theme {
--terra-folder-tree-item-background-color-hover: #f4fafe;
// --terra-folder-tree-item-background-color-selected: ;
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like you might need to remove this commented code.

Comment on lines +103 to +112
<Arrange
fitStart={(
<Spacer paddingLeft="medium" paddingRight="medium" isInlineBlock>
{itemIcon}
</Spacer>
)}
fill={label}
alignFitStart="center"
/>
</span>
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of adding this complexity. Can't we just use the listStyleImage property to set the image? Also, are we able to leverage list-style-position to assist with the indentation? Can we maybe limit the custom styling necessary?

aria-selected={isSelected}
>
<input
type="radio"
Copy link
Contributor

Choose a reason for hiding this comment

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

These shouldn't be radio buttons since they can't be properly associated with each other and we'll be using aria-selected instead.

text={title}
level={headerLevel}
/>
<ul
Copy link
Contributor

Choose a reason for hiding this comment

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

This needs an aria-labeledby pointing to the header above it or an aria-label with the same text.

Copy link
Contributor

@nikhitasharma nikhitasharma left a comment

Choose a reason for hiding this comment

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

Approving. The remaining review comments will be addressed in a follow-up PR.

@github-actions github-actions bot temporarily deployed to preview-pr-1888 November 21, 2023 23:12 Destroyed
@nikhitasharma nikhitasharma merged commit d4d947c into main Nov 21, 2023
20 checks passed
@nikhitasharma nikhitasharma deleted the folder-tree branch November 21, 2023 23:17
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants