diff --git a/packages/ui-link/src/Link/README.md b/packages/ui-link/src/Link/README.md index 64c3980e51..6a895d1565 100644 --- a/packages/ui-link/src/Link/README.md +++ b/packages/ui-link/src/Link/README.md @@ -10,7 +10,13 @@ describes: Link --- type: example --- -The quick brown fox jumps over the lazy dog. +
+The quick brown fox jumps over the lazy dog. +jumps +
``` ```js @@ -18,7 +24,9 @@ type: example type: example --- - The quick brown fox jumps over the lazy dog. + The quick brown fox jumps over the lazy dog. ``` @@ -154,6 +162,57 @@ type: example ``` +### Theme overrides + +Examples showing how theme overrides work for Link: + +```js +--- +type: example +--- +
+ The quick brown fox jumps over the lazy dog. + +
+``` + +```js +--- +type: example +--- + + The quick brown fox jumps over the lazy dog. +
+ The quick brown fox } + themeOverride={{ + focusOutlineWidth: '0.5rem', + focusOutlineStyle: 'dashed', + focusOutlineBorderRadius: '0', + focusInverseIconOutlineColor: 'red' + }} + >jumps over the lazy dog. +
+``` + ### Guidelines ```js diff --git a/packages/ui-link/src/Link/styles.ts b/packages/ui-link/src/Link/styles.ts index f7480867bf..5121d1d0a7 100644 --- a/packages/ui-link/src/Link/styles.ts +++ b/packages/ui-link/src/Link/styles.ts @@ -80,12 +80,8 @@ const generateStyle = ( fontWeight: componentTheme.fontWeight, transition: 'outline-color 0.2s', verticalAlign: 'baseline', - // set up focus styles outlineColor: 'transparent', - outlineWidth: componentTheme.focusOutlineWidth, - outlineStyle: componentTheme.focusOutlineStyle, - borderRadius: componentTheme.focusOutlineBorderRadius, outlineOffset: '0.25rem', textUnderlineOffset: componentTheme.textUnderlineOffset, @@ -96,7 +92,10 @@ const generateStyle = ( alignItems: 'center' }), - '&:focus': { + '&&&&&&:focus': { + outlineWidth: componentTheme.focusOutlineWidth, + outlineStyle: componentTheme.focusOutlineStyle, + borderRadius: componentTheme.focusOutlineBorderRadius, outlineColor: componentTheme.focusOutlineColor }, '&[aria-disabled]': { @@ -114,7 +113,8 @@ const generateStyle = ( ...baseStyles, cursor: 'pointer', color: componentTheme.color, - '&:focus': { + // This needs stronger specificity than `View` + '&&&&&:focus': { color: componentTheme.color, outlineColor: componentTheme.focusOutlineColor }, @@ -147,10 +147,15 @@ const generateStyle = ( const inverseStyles = { color: componentTheme.colorInverse, - '&:focus': { - outlineColor: componentTheme.focusInverseIconOutlineColor + '&&&&&:focus': { + outlineColor: componentTheme.focusInverseOutlineColor }, - '&:hover, &:focus, &:active': { + ...(renderIcon && { + '&&&&&:focus': { + outlineColor: componentTheme.focusInverseIconOutlineColor + } + }), + '&:hover, &&&&&:focus, &:active': { color: componentTheme.colorInverse } }