File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -87,6 +87,10 @@ const stories = [
8787 title : 'Trailing Counter No Text' ,
8888 id : 'components-button-features--trailing-counter-with-no-text' ,
8989 } ,
90+ {
91+ title : 'Dev Link Variant With Underline Preference' ,
92+ id : 'components-button-dev--link-variant-with-underline-preference' ,
93+ } ,
9094] as const
9195
9296test . describe ( 'Button' , ( ) => {
Original file line number Diff line number Diff line change @@ -286,12 +286,14 @@ export const decorators = [
286286
287287 // Set data-a11y-link-underlines=true to enable underlines in all stories except the Link dev Inline Story.
288288 let wrapperProps =
289- context . id !== 'components-link-dev--inline'
289+ context . id !== 'components-link-dev--inline' ||
290+ context . id !== 'components-button-dev--link-variant-with-underline-preference'
290291 ? {
291- 'data-a11y-link-underlines' : context . id !== 'components-link-dev--inline' ,
292+ 'data-a11y-link-underlines' : true ,
292293 className : clsx ( 'story-wrap' ) ,
293294 }
294295 : { className : clsx ( 'story-wrap' ) }
296+ console . log ( 'context.id' , context . id )
295297 const showSurroundingElements =
296298 context . globals . showSurroundingElements ?? window . localStorage . getItem ( 'showSurroundingElements' ) === 'true'
297299 return context . globals . colorScheme === 'all' ? (
Original file line number Diff line number Diff line change @@ -85,3 +85,32 @@ export const DisabledButtonVariants = () => {
8585 </ Stack >
8686 )
8787}
88+
89+ export const LinkVariantWithUnderlinePreference = ( ) => {
90+ return (
91+ < Stack gap = "spacious" >
92+ < Stack gap = "condensed" align = "start" data-a11y-link-underlines = "true" >
93+ < Button variant = "link" > Underline pref on</ Button >
94+ < Button
95+ variant = "link"
96+ leadingVisual = { SearchIcon }
97+ trailingAction = { TriangleDownIcon }
98+ trailingVisual = { HeartFillIcon }
99+ >
100+ Underline pref on
101+ </ Button >
102+ </ Stack >
103+ < Stack gap = "condensed" align = "start" data-a11y-link-underlines = "false" >
104+ < Button variant = "link" > Underline pref off</ Button >
105+ < Button
106+ variant = "link"
107+ leadingVisual = { SearchIcon }
108+ trailingAction = { TriangleDownIcon }
109+ trailingVisual = { HeartFillIcon }
110+ >
111+ Underline pref off
112+ </ Button >
113+ </ Stack >
114+ </ Stack >
115+ )
116+ }
Original file line number Diff line number Diff line change 467467 color : var (--fgColor-link );
468468 text-align : left;
469469 border : unset;
470+ border-radius : 0 ;
470471
471472 & : hover : not (: disabled , [data-inactive ]) {
472473 text-decoration : underline;
498499 }
499500 }
500501
502+ [data-a11y-link-underlines = 'true' ] & : where ([data-variant = 'link' ]) {
503+ & : not (: has (.Visual )) {
504+ text-decoration : underline;
505+ }
506+
507+ & : has (.Visual ) {
508+ background-image : linear-gradient (to right, currentColor, currentColor);
509+ background-size : 100% 1.5px ;
510+ background-position : 0 calc (100% - 2px );
511+ background-repeat : no-repeat;
512+
513+ & : hover {
514+ text-decoration : none;
515+ }
516+ }
517+ }
518+
519+ [data-a11y-link-underlines = 'false' ] & : where ([data-variant = 'link' ]) {
520+ & : not (: has (.Visual )) {
521+ text-decoration : none;
522+ background-image : none;
523+ }
524+
525+ & : has (.Visual ) {
526+ background-image : none;
527+ }
528+ }
529+
501530 /* Inactive */
502531
503532 & : where ([data-inactive ]),
You can’t perform that action at this time.
0 commit comments