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

Add disable state for the links in Nav component #8120

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions apps/vr-tests/src/stories/Nav.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,20 +69,22 @@ const disabledLinks: INavLink[] = [
name: 'MSN',
url: 'http://msn.com',
key: 'key2',
disabled: true,
altText: 'The link is temporary disabled'
disabled: true
}
],
isExpanded: true
},
{ name: 'Documents', url: 'http://example.com', key: 'key3' },

{
name: 'Documents',
url: 'http://example.com',
key: 'key3'
},
{
name: 'Unavailable Item',
url: 'http://cnn.com',
icon: 'News',
icon: IconNames.News,
Copy link
Contributor

Choose a reason for hiding this comment

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

You're right about the deprecation of IconNames, good catch. We can change this back to 'News' like you had before.

Suggested change
icon: IconNames.News,
icon: 'News',

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 following solution can work for OTB constant icons
https://gist.github.com/winperec/052cba5e7fcb563ab92ccc8ae2f0b1bb
but I think Office UI Fabric supports registering custom icons and in this case it will not work :)

disabled: true,
key: 'key9'
key: 'key4'
}
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,32 @@ export class NavBasicExample extends React.Component<any, any> {
],
isExpanded: true
},
{ name: 'Documents', url: 'http://example.com', key: 'key3', isExpanded: true },
{ name: 'Pages', url: 'http://msn.com', key: 'key4' },
{ name: 'Notebook', url: 'http://msn.com', key: 'key5' },
{ name: 'Communication and Media', url: 'http://msn.com', key: 'key6' },
{
name: 'Documents',
url: 'http://example.com',
key: 'key3',
isExpanded: true
},
{
name: 'Pages',
url: 'http://msn.com',
key: 'key4'
},
{
name: 'Notebook',
url: 'http://msn.com',
key: 'key5'
},
{
name: 'Communication and Media',
url: 'http://msn.com',
key: 'key6'
},
{
name: 'News',
url: 'http://cnn.com',
icon: 'News',
key: 'key8'
key: 'key7'
winperec marked this conversation as resolved.
Show resolved Hide resolved
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,17 @@ export class NavDisabledItemsExample extends React.Component<any, any> {
],
isExpanded: true
},
{ name: 'Documents', url: 'http://example.com', key: 'key3' },

{
name: 'Documents',
url: 'http://example.com',
key: 'key3'
},
{
name: 'Unavailable Item',
url: 'http://cnn.com',
icon: 'News',
natalieethell marked this conversation as resolved.
Show resolved Hide resolved
disabled: true,
key: 'key9'
key: 'key4'
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,39 @@ export class NavNestedExample extends React.Component<any, any> {
name: 'Parent link',
url: 'http://example.com',
links: [
{ name: 'Child link', url: 'http://example.com' },
{
name: 'Child link',
url: 'http://example.com'
},
{
name: 'Child link',
url: 'http://example.com',
links: [{ name: 'Child link', url: 'http://example.com' }, { name: 'Child link', url: 'http://example.com' }]
links: [
{
name: 'Child link',
url: 'http://example.com'
},
{
name: 'Child link',
url: 'http://example.com'
}
]
},
{ name: 'Child link', url: 'http://example.com' }
{
name: 'Child link',
url: 'http://example.com'
}
]
},
{
name: 'Parent link',
url: 'http://example.com',
links: [{ name: 'Child link', url: 'http://example.com' }]
links: [
{
name: 'Child link',
url: 'http://example.com'
}
]
}
]
}
Expand Down