Skip to content

Commit f531f10

Browse files
Tweakifiedtay1orjonesDanielSmithUIkennylam
authored
feat(tree-links): Adds support for link nodes in the TreeView component (#18409)
* feat(tree-links): Adds support for link nodes in the TreeView component * feat: Sets treenodes with a href active when the href is the current page, utilises the Link component for nodes with links * chore: Corrects formatting and styling order * fix: Responds to feedback - ensures href does not override active or selected * chore: Adds TreeView links e2e tests and updates snapshots * chore: Adds TreeNode test to test specifying the href for parent nodes * chore: Adds reach/router dependency * feat: Utilises reach router in TreeNodes with links to navigate * feat: Updates TreeView storybook, adds a main content section which updates when a TreeNode with link is clicked * chore: Updates for lint and format * chore: Simplifies scss structure * chore: Updates lint styling * chore: Removes reach/router dependency * chore: Removes reach/router navigation from TreeNodes with links * fix: Updates storybook for TreeNodes with links to simulate a link * fix: Improves storybook for TreeNodes to preventDefault on links * chore: Moves current page main body to a variable * Revert "chore: Moves current page main body to a variable" This reverts commit fc2b973. * fix: Resolves onSelect calling twice when using the TreeNode with links component * chore: Stops TreeView with links storybook from re-rendering when clicking on a node * style: Improves TreeView with links storybook styling * chore: Corrects formatting * chore: Moves node const inside TreeViewWithLinks component --------- Co-authored-by: Taylor Jones <tay1orjones@users.noreply.github.com> Co-authored-by: Daniel Smith <DanielP.Smith@ibm.com> Co-authored-by: kennylam <909118+kennylam@users.noreply.github.com>
1 parent 23a11c1 commit f531f10

File tree

11 files changed

+470
-47
lines changed

11 files changed

+470
-47
lines changed

.all-contributorsrc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1764,6 +1764,17 @@
17641764
"review"
17651765
]
17661766
},
1767+
{
1768+
"login": "Tweakified",
1769+
"name": "Daniel Smith",
1770+
"avatar_url": "https://avatars.githubusercontent.com/u/58192912?v=4",
1771+
"profile": "https://github.com/Tweakified",
1772+
"contributions": [
1773+
"code",
1774+
"a11y",
1775+
"doc"
1776+
]
1777+
},
17671778
{
17681779
"login": "enricobguedes",
17691780
"name": "enricobguedes",

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,7 @@ check out our [Contributing Guide](/.github/CONTRIBUTING.md) and our
326326
<td align="center"><a href="https://github.com/a88zach"><img src="https://avatars.githubusercontent.com/u/1724822?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Zach Tindall</b></sub></a><br /><a href="https://github.com/carbon-design-system/carbon/commits?author=a88zach" title="Code">💻</a></td>
327327
<td align="center"><a href="https://github.com/vsvsv"><img src="https://avatars.githubusercontent.com/u/9214692?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Vsevolod Platunov</b></sub></a><br /><a href="https://github.com/carbon-design-system/carbon/commits?author=vsvsv" title="Code">💻</a></td>
328328
<td align="center"><a href="https://github.com/heloiselui"><img src="https://avatars.githubusercontent.com/u/71858203?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Heloise Lui</b></sub></a><br /><a href="https://github.com/carbon-design-system/carbon/commits?author=heloiselui" title="Code">💻</a> <a href="https://github.com/carbon-design-system/carbon/commits?author=heloiselui" title="Documentation">📖</a> <a href="#a11y-heloiselui" title="Accessibility">️️️️♿️</a> <a href="https://github.com/carbon-design-system/carbon/pulls?q=is%3Apr+reviewed-by%3Aheloiselui" title="Reviewed Pull Requests">👀</a></td>
329+
<td align="center"><a href="https://github.com/Tweakified"><img src="https://avatars.githubusercontent.com/u/58192912?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Daniel Smith</b></sub></a><br /><a href="https://github.com/carbon-design-system/carbon/commits?author=Tweakified" title="Code">💻</a> <a href="#a11y-Tweakified" title="Accessibility">️️️️♿️</a> <a href="https://github.com/carbon-design-system/carbon/commits?author=Tweakified" title="Documentation">📖</a></td>
329330
<td align="center"><a href="https://github.com/enricobguedes"><img src="https://avatars.githubusercontent.com/u/45374536?v=4?s=100" width="100px;" alt=""/><br /><sub><b>enricobguedes</b></sub></a><br /><a href="https://github.com/carbon-design-system/carbon/commits?author=enricobguedes" title="Code">💻</a></td>
330331
</tr>
331332
</table>

e2e/components/TreeView/TreeView-test.avt.e2e.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,17 @@ test.describe('@avt TreeView', () => {
3333
await expect(page).toHaveNoACViolations('components-treeview--with-icons');
3434
});
3535

36+
test('@avt-advanced-states with-links', async ({ page }) => {
37+
await visitStory(page, {
38+
component: 'TreeView',
39+
id: 'components-treeview--with-links',
40+
globals: {
41+
theme: 'white',
42+
},
43+
});
44+
await expect(page).toHaveNoACViolations('components-treeview--with-links');
45+
});
46+
3647
test('@avt-keyboard-nav', async ({ page }) => {
3748
await visitStory(page, {
3849
component: 'TreeView',

e2e/components/TreeView/TreeView-test.e2e.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@ test.describe('TreeView', () => {
2121
theme,
2222
});
2323
});
24+
25+
test('treeview-links @vrt', async ({ page }) => {
26+
await snapshotStory(page, {
27+
component: 'TreeView',
28+
id: 'components-treeview--with-links',
29+
theme,
30+
});
31+
});
2432
});
2533
});
2634
});

packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9641,6 +9641,9 @@ Map {
96419641
"disabled": Object {
96429642
"type": "bool",
96439643
},
9644+
"href": Object {
9645+
"type": "string",
9646+
},
96449647
"id": Object {
96459648
"type": "string",
96469649
},
@@ -9731,6 +9734,9 @@ Map {
97319734
"disabled": Object {
97329735
"type": "bool",
97339736
},
9737+
"href": Object {
9738+
"type": "string",
9739+
},
97349740
"id": Object {
97359741
"type": "string",
97369742
},

0 commit comments

Comments
 (0)