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

feat: File token group [internal] #2950

Merged
merged 24 commits into from
Nov 11, 2024
Merged

Conversation

katiegeorge
Copy link
Member

@katiegeorge katiegeorge commented Oct 29, 2024

Description

This PR updates the file-upload component to use the newly refactored file token group. The only changes externally are adding a horizontal variant to the file upload.

This PR is part one of multiple for file upload decomposition, to make the pull requests easier to review.

Full plan:

  • File dropzone (internal)
  • File input (internal)
  • File token group (internal) - this PR
  • File dropzone (external)
  • File input (external)
  • File token group (external)
  • Adding file-upload variant to button group

Related links, issue #, if available: n/a

How has this been tested?

Review checklist

The following items are to be evaluated by the author(s) and the reviewer(s).

Correctness

  • Changes include appropriate documentation updates.
  • Changes are backward-compatible if not indicated, see CONTRIBUTING.md.
  • Changes do not include unsupported browser features, see CONTRIBUTING.md.
  • Changes were manually tested for accessibility, see accessibility guidelines.

Security

Testing

  • Changes are covered with new/existing unit tests?
  • Changes are covered with new/existing integration tests?

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Copy link

codecov bot commented Oct 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.30%. Comparing base (62f01ce) to head (7a75e80).
Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2950      +/-   ##
==========================================
+ Coverage   96.27%   96.30%   +0.02%     
==========================================
  Files         769      771       +2     
  Lines       21764    21812      +48     
  Branches     7038     7446     +408     
==========================================
+ Hits        20954    21005      +51     
+ Misses        802      799       -3     
  Partials        8        8              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

src/file-upload/internal.tsx Outdated Show resolved Hide resolved
src/internal/components/file-token-group/file-token.tsx Outdated Show resolved Hide resolved
src/internal/components/file-token-group/file-token.tsx Outdated Show resolved Hide resolved
src/internal/components/token-list/index.tsx Outdated Show resolved Hide resolved
src/token-group/dismiss-button.tsx Outdated Show resolved Hide resolved
src/token-group/token.tsx Outdated Show resolved Hide resolved
@pan-kot
Copy link
Member

pan-kot commented Nov 8, 2024

I found a regression. The current file tokens allow the text to wrap and are responsive even if the file name is long. The new tokens do not allow wrapping and are not properly responsive. The horizontal ones do use truncation but it only works when the component size does not change after rendering.

Screen.Recording.2024-11-08.at.10.09.54.mov

const fileNameContainerRef = useRef<HTMLDivElement>(null);
const [showTooltip, setShowTooltip] = useState(false);

function isEllipsisActive() {
Copy link
Member

Choose a reason for hiding this comment

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

Can we use css text-overflow for ellipsis instead?

Copy link
Member Author

Choose a reason for hiding this comment

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

We do. We need this to determine when to show the tooltip, so it needs to be in javascript. Not sure if renaming this "isTooltipActive" would be more apt, since this is literally what its doing?

* Specifies if the control is read-only, which prevents the
* user from modifying the value. A read-only control is still focusable.
*/
readOnly?: boolean;
Copy link
Member

Choose a reason for hiding this comment

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

Why do we have readOnly on the group level and disabled on the file level?

Copy link
Member

Choose a reason for hiding this comment

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

Is disabled prop even used?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch, I decided to remove the disabled property for now since we don't have a use case. I'll remove that property. As an FYI, the reason one is on the group and one on the token is consistent with the token group.

@use '../internal/styles/tokens' as awsui;
@use './constants' as constants;

@mixin token-box-styles {
Copy link
Member

Choose a reason for hiding this comment

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

nice 👍

@katiegeorge katiegeorge added this pull request to the merge queue Nov 11, 2024
Merged via the queue into main with commit 6539f15 Nov 11, 2024
39 checks passed
@katiegeorge katiegeorge deleted the kg/file-token-group-internal branch November 11, 2024 18:32
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.

2 participants