-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add link as new web component (#31676)
- Loading branch information
1 parent
e56dc8d
commit a958850
Showing
17 changed files
with
518 additions
and
94 deletions.
There are no files selected for viewing
53 changes: 53 additions & 0 deletions
53
apps/vr-tests-web-components/src/stories/link/link.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,53 @@ | ||
import * as React from 'react'; | ||
import { default as parse } from 'html-react-parser'; | ||
import { Steps, StoryWright } from 'storywright'; | ||
import { LinkDefinition, FluentDesignSystem } from '@fluentui/web-components'; | ||
|
||
LinkDefinition.define(FluentDesignSystem.registry); | ||
|
||
const linkId = 'link-id'; | ||
|
||
const steps = new Steps() | ||
.snapshot('default', { cropTo: '.testWrapper' }) | ||
.hover(`#${linkId}`) | ||
.snapshot('hover', { cropTo: '.testWrapper' }) | ||
.mouseDown(`#${linkId}`) | ||
.snapshot('pressed', { cropTo: '.testWrapper' }) | ||
.end(); | ||
|
||
export default { | ||
title: 'Link', | ||
decorators: [ | ||
(story: () => React.ReactElement) => { | ||
return ( | ||
<StoryWright steps={steps}> | ||
<div className="testWrapper" style={{ width: '300px' }}> | ||
{story()} | ||
</div> | ||
</StoryWright> | ||
); | ||
}, | ||
], | ||
}; | ||
|
||
export const Default = () => parse(`<fluent-link id="${linkId}">Default</fluent-link>`); | ||
|
||
export const Subtle = () => parse(`<fluent-link id="${linkId}" appearance="subtle">Primary</fluent-link>`); | ||
|
||
export const Inline = () => | ||
parse(`<p>This is an <fluent-link id="${linkId}" inline>inline link</fluent-link> used alongside text</p>.`); | ||
|
||
export const WithLongText = () => | ||
parse(` | ||
<style> | ||
.max-width { | ||
display: block; | ||
width: 250px; | ||
} | ||
</style> | ||
<p class="max-width"> | ||
This paragraph contains a link which is very long. | ||
<fluent-link href="#">Fluent links wrap correctly between lines when they are very long.</fluent-link> This is | ||
because they are inline elements. | ||
</p> | ||
`); |
7 changes: 7 additions & 0 deletions
7
change/@fluentui-web-components-b66f6166-9635-4438-87af-8cb454ae22d1.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": "prerelease", | ||
"comment": "add link as a new web component", | ||
"packageName": "@fluentui/web-components", | ||
"email": "13071055+chrisdholt@users.noreply.github.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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import { FluentDesignSystem } from '../fluent-design-system.js'; | ||
import { definition } from './link.definition.js'; | ||
|
||
definition.define(FluentDesignSystem.registry); |
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,4 @@ | ||
export { definition as LinkDefinition } from './link.definition.js'; | ||
export { Link } from './link.js'; | ||
export { LinkAppearance, LinkTarget } from './link.options.js'; | ||
export { template as LinkTemplate } from './link.template.js'; |
Oops, something went wrong.