File tree 3 files changed +35
-3
lines changed
3 files changed +35
-3
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,14 @@ export const LinkWithOpenIcon: StoryObj<Args> = {
37
37
} ,
38
38
} ;
39
39
40
+ export const LinkWithFormattedChildren : StoryObj < Args > = {
41
+ args : {
42
+ children : < em > emphasized link</ em > ,
43
+ context : 'standalone' ,
44
+ icon : 'open-in-new' ,
45
+ } ,
46
+ } ;
47
+
40
48
export const Emphasis : StoryObj < Args > = {
41
49
args : {
42
50
size : 'md' ,
Original file line number Diff line number Diff line change @@ -15,9 +15,9 @@ export type LinkV2Props<ExtendedElement = unknown> =
15
15
*/
16
16
as ?: string | React . ElementType ;
17
17
/**
18
- * The link contents or label.
18
+ * The link contents or label. Using ReactNode to support customized text treatments
19
19
*/
20
- children : string ;
20
+ children : React . ReactNode ;
21
21
// Design API
22
22
/**
23
23
* Where `Link` sits alongside other text and content:
@@ -34,7 +34,6 @@ export type LinkV2Props<ExtendedElement = unknown> =
34
34
* Extra or lowered colors added to a link
35
35
*/
36
36
emphasis ?: 'default' | 'high' | 'low' ;
37
-
38
37
/**
39
38
* Link size inherits from the surrounding text.
40
39
*/
Original file line number Diff line number Diff line change @@ -87,6 +87,31 @@ exports[`<Link /> LinkWithChevron story renders snapshot 1`] = `
87
87
</a >
88
88
` ;
89
89
90
+ exports [` <Link /> LinkWithFormattedChildren story renders snapshot 1` ] = `
91
+ <a
92
+ class = " link link--context-standalone link--emphasis-default link--has-right-icon link--size-lg"
93
+ href = " https://go.czi.team/eds"
94
+ >
95
+ <em >
96
+ emphasized link
97
+ </em >
98
+ <svg
99
+ aria-hidden = " true"
100
+ class = " icon link__icon"
101
+ fill = " currentColor"
102
+ height = " 1.5rem"
103
+ style = " --icon-size: 1.5rem;"
104
+ viewBox = " 0 0 24 24"
105
+ width = " 1.5rem"
106
+ xmlns = " http://www.w3.org/2000/svg"
107
+ >
108
+ <path
109
+ d = " M18 19H6c-.55 0-1-.45-1-1V6c0-.55.45-1 1-1h5c.55 0 1-.45 1-1s-.45-1-1-1H5c-1.11 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-6c0-.55-.45-1-1-1s-1 .45-1 1v5c0 .55-.45 1-1 1zM14 4c0 .55.45 1 1 1h2.59l-9.13 9.13c-.39.39-.39 1.02 0 1.41.39.39 1.02.39 1.41 0L19 6.41V9c0 .55.45 1 1 1s1-.45 1-1V4c0-.55-.45-1-1-1h-5c-.55 0-1 .45-1 1z"
110
+ />
111
+ </svg >
112
+ </a >
113
+ ` ;
114
+
90
115
exports [` <Link /> LinkWithOpenIcon story renders snapshot 1` ] = `
91
116
<a
92
117
class = " link link--context-standalone link--emphasis-default link--has-right-icon link--size-lg"
You can’t perform that action at this time.
0 commit comments