-
Notifications
You must be signed in to change notification settings - Fork 536
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: Add truncate
prop
#5122
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
bb1a4bd
Add "opt in" prop for `TreeView` to opt in to truncation of text
TylerJDev da50a14
Merge branch 'main' into tylerjdev/truncate-opt-in-treeview
TylerJDev ffe6535
Make non-truncate opt-in
TylerJDev 30c8e79
Add extra CSS, stories
TylerJDev 02aefd7
Add changeset
TylerJDev 7abad59
Cleanup stories
TylerJDev b73c844
Remove `truncate` from story
TylerJDev 33c63ac
Add back prop to story
TylerJDev dc84f37
test(vrt): update snapshots
TylerJDev ed1bd8c
Fix story typos
TylerJDev 19e2ac9
test(vrt): update snapshots
TylerJDev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@primer/react': minor | ||
--- | ||
|
||
TreeView: Adds prop `truncate`, keeps default behavior of truncation but allows for text to wrap when turned off. |
Binary file modified
BIN
-2.61 KB
(89%)
...nts/TreeView.test.ts-snapshots/TreeView-Files-Changed-dark-colorblind-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-2.67 KB
(89%)
...ponents/TreeView.test.ts-snapshots/TreeView-Files-Changed-dark-dimmed-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-2.7 KB
(89%)
.../TreeView.test.ts-snapshots/TreeView-Files-Changed-dark-high-contrast-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-2.6 KB
(89%)
...ots/components/TreeView.test.ts-snapshots/TreeView-Files-Changed-dark-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-2.61 KB
(89%)
...nts/TreeView.test.ts-snapshots/TreeView-Files-Changed-dark-tritanopia-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-2.62 KB
(89%)
...ts/TreeView.test.ts-snapshots/TreeView-Files-Changed-light-colorblind-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-2.7 KB
(89%)
...TreeView.test.ts-snapshots/TreeView-Files-Changed-light-high-contrast-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-2.64 KB
(89%)
...ts/components/TreeView.test.ts-snapshots/TreeView-Files-Changed-light-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-2.64 KB
(89%)
...ts/TreeView.test.ts-snapshots/TreeView-Files-Changed-light-tritanopia-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-2.5 KB
(88%)
.../components/TreeView.test.ts-snapshots/TreeView-Files-dark-colorblind-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-2.66 KB
(88%)
...hots/components/TreeView.test.ts-snapshots/TreeView-Files-dark-dimmed-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-2.53 KB
(88%)
...mponents/TreeView.test.ts-snapshots/TreeView-Files-dark-high-contrast-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-2.51 KB
(88%)
...t/snapshots/components/TreeView.test.ts-snapshots/TreeView-Files-dark-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-2.5 KB
(88%)
.../components/TreeView.test.ts-snapshots/TreeView-Files-dark-tritanopia-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-2.51 KB
(88%)
...components/TreeView.test.ts-snapshots/TreeView-Files-light-colorblind-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-2.46 KB
(88%)
...ponents/TreeView.test.ts-snapshots/TreeView-Files-light-high-contrast-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-2.51 KB
(88%)
.../snapshots/components/TreeView.test.ts-snapshots/TreeView-Files-light-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-2.51 KB
(88%)
...components/TreeView.test.ts-snapshots/TreeView-Files-light-tritanopia-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
@TylerJDev do you think it might make more sense to make this false by default? Just wondering if this is kind of a breaking change. Have you run an integration test?
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.
For this, I set it to
true
to keep the default behavior of the text truncating when not using the prop. When using it withfalse
, it will wrap instead. The new behavior should only be opt-in, so that we can release this under a non breaking change.Let me know if you think we should change the prop name (e.g.
shouldNotTruncate
,wrap
). Not sure iftruncate
is confusing or not 😅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.
OH sorry I totally read the CSS wrong. Awesome! LGTM