-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Adding span as an option for Link to render as (#29937)
* feat: Adding span as an option for Link to render as. * Adding tabIndex to Link as span. * Adding change file. * Addressing PR feedback.
- Loading branch information
Showing
8 changed files
with
149 additions
and
13 deletions.
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
7 changes: 7 additions & 0 deletions
7
change/@fluentui-react-link-aaa21628-9075-404d-8305-6cf56982b4ba.json
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,7 @@ | ||
{ | ||
"type": "minor", | ||
"comment": "feat: Adding span as an option for Link to render as.", | ||
"packageName": "@fluentui/react-link", | ||
"email": "humbertomakotomorimoto@gmail.com", | ||
"dependentChangeType": "patch" | ||
} |
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
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
25 changes: 25 additions & 0 deletions
25
packages/react-components/react-link/stories/Link/LinkAsSpan.stories.tsx
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,25 @@ | ||
import * as React from 'react'; | ||
import { Link, makeResetStyles } from '@fluentui/react-components'; | ||
|
||
const useDivWithWidthClassName = makeResetStyles({ | ||
width: '200px', | ||
}); | ||
|
||
export const AsSpan = () => ( | ||
<div className={useDivWithWidthClassName()}> | ||
The following link renders as a span.{' '} | ||
<Link as="span">Links that render as a span wrap correctly between lines when their content is very long</Link>.{' '} | ||
This is because they behave as regular inline elements. | ||
</div> | ||
); | ||
|
||
AsSpan.parameters = { | ||
docs: { | ||
description: { | ||
story: [ | ||
'A Link can be rendered as an html `<span>`, in which case it will have `role="button"` set.', | ||
'Links that render as a span wrap correctly between lines, behaving as inline elements as opposed to links rendered as buttons, which always behave as inline-block elements that do not wrap correctly.', | ||
].join('\n'), | ||
}, | ||
}, | ||
}; |
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