diff --git a/components/image/__tests__/__snapshots__/browser.test.tsx.snap b/components/image/__tests__/__snapshots__/browser.test.tsx.snap
index 9ac5fda..79824c3 100644
--- a/components/image/__tests__/__snapshots__/browser.test.tsx.snap
+++ b/components/image/__tests__/__snapshots__/browser.test.tsx.snap
@@ -321,6 +321,7 @@ initialize {
padding: calc(0 * 0.8) calc(0 * 1.7);
border-radius: 0;
width: fit-content;
+ transition: color 200ms ease 0ms;
}
.link:hover,
@@ -331,6 +332,7 @@ initialize {
.link:hover {
background-color: unset;
+ color: inherit;
}
",
"next": null,
@@ -366,6 +368,7 @@ initialize {
padding: calc(0 * 0.8) calc(0 * 1.7);
border-radius: 0;
width: fit-content;
+ transition: color 200ms ease 0ms;
}
.link:hover,
@@ -376,6 +379,7 @@ initialize {
.link:hover {
background-color: unset;
+ color: inherit;
}
",
"next": null,
@@ -510,6 +514,7 @@ initialize {
padding: calc(0 * 0.8) calc(0 * 1.7);
border-radius: 0;
width: fit-content;
+ transition: color 200ms ease 0ms;
}
.link:hover,
@@ -520,6 +525,7 @@ initialize {
.link:hover {
background-color: unset;
+ color: inherit;
}
",
"next": null,
@@ -555,6 +561,7 @@ initialize {
padding: calc(0 * 0.8) calc(0 * 1.7);
border-radius: 0;
width: fit-content;
+ transition: color 200ms ease 0ms;
}
.link:hover,
@@ -565,6 +572,7 @@ initialize {
.link:hover {
background-color: unset;
+ color: inherit;
}
",
"next": null,
@@ -870,6 +878,7 @@ initialize {
padding: calc(0 * 0.8) calc(0 * 1.7);
border-radius: 0;
width: fit-content;
+ transition: color 200ms ease 0ms;
}
.link:hover,
@@ -880,6 +889,7 @@ initialize {
.link:hover {
background-color: unset;
+ color: inherit;
}
",
"next": null,
@@ -915,6 +925,7 @@ initialize {
padding: calc(0 * 0.8) calc(0 * 1.7);
border-radius: 0;
width: fit-content;
+ transition: color 200ms ease 0ms;
}
.link:hover,
@@ -925,6 +936,7 @@ initialize {
.link:hover {
background-color: unset;
+ color: inherit;
}
",
"next": null,
@@ -1271,6 +1283,7 @@ initialize {
padding: calc(0 * 0.8) calc(0 * 1.7);
border-radius: 0;
width: fit-content;
+ transition: color 200ms ease 0ms;
}
.link:hover,
@@ -1281,6 +1294,7 @@ initialize {
.link:hover {
background-color: unset;
+ color: inherit;
}
",
"next": null,
@@ -1316,6 +1330,7 @@ initialize {
padding: calc(0 * 0.8) calc(0 * 1.7);
border-radius: 0;
width: fit-content;
+ transition: color 200ms ease 0ms;
}
.link:hover,
@@ -1326,6 +1341,7 @@ initialize {
.link:hover {
background-color: unset;
+ color: inherit;
}
",
"next": null,
@@ -1460,6 +1476,7 @@ initialize {
padding: calc(0 * 0.8) calc(0 * 1.7);
border-radius: 0;
width: fit-content;
+ transition: color 200ms ease 0ms;
}
.link:hover,
@@ -1470,6 +1487,7 @@ initialize {
.link:hover {
background-color: unset;
+ color: inherit;
}
",
"next": null,
@@ -1505,6 +1523,7 @@ initialize {
padding: calc(0 * 0.8) calc(0 * 1.7);
border-radius: 0;
width: fit-content;
+ transition: color 200ms ease 0ms;
}
.link:hover,
@@ -1515,6 +1534,7 @@ initialize {
.link:hover {
background-color: unset;
+ color: inherit;
}
",
"next": null,
@@ -1820,6 +1840,7 @@ initialize {
padding: calc(0 * 0.8) calc(0 * 1.7);
border-radius: 0;
width: fit-content;
+ transition: color 200ms ease 0ms;
}
.link:hover,
@@ -1830,6 +1851,7 @@ initialize {
.link:hover {
background-color: unset;
+ color: inherit;
}
",
"next": null,
@@ -1865,6 +1887,7 @@ initialize {
padding: calc(0 * 0.8) calc(0 * 1.7);
border-radius: 0;
width: fit-content;
+ transition: color 200ms ease 0ms;
}
.link:hover,
@@ -1875,6 +1898,7 @@ initialize {
.link:hover {
background-color: unset;
+ color: inherit;
}
",
"next": null,
@@ -2964,6 +2988,7 @@ initialize {
padding: calc(0 * 0.8) calc(0 * 1.7);
border-radius: 0;
width: fit-content;
+ transition: color 200ms ease 0ms;
}
.link:hover,
@@ -2974,6 +2999,7 @@ initialize {
.link:hover {
background-color: unset;
+ color: inherit;
}
",
"next": null,
@@ -3009,6 +3035,7 @@ initialize {
padding: calc(0 * 0.8) calc(0 * 1.7);
border-radius: 0;
width: fit-content;
+ transition: color 200ms ease 0ms;
}
.link:hover,
@@ -3019,6 +3046,7 @@ initialize {
.link:hover {
background-color: unset;
+ color: inherit;
}
",
"next": null,
@@ -3153,6 +3181,7 @@ initialize {
padding: calc(0 * 0.8) calc(0 * 1.7);
border-radius: 0;
width: fit-content;
+ transition: color 200ms ease 0ms;
}
.link:hover,
@@ -3163,6 +3192,7 @@ initialize {
.link:hover {
background-color: unset;
+ color: inherit;
}
",
"next": null,
@@ -3198,6 +3228,7 @@ initialize {
padding: calc(0 * 0.8) calc(0 * 1.7);
border-radius: 0;
width: fit-content;
+ transition: color 200ms ease 0ms;
}
.link:hover,
@@ -3208,6 +3239,7 @@ initialize {
.link:hover {
background-color: unset;
+ color: inherit;
}
",
"next": null,
@@ -3513,6 +3545,7 @@ initialize {
padding: calc(0 * 0.8) calc(0 * 1.7);
border-radius: 0;
width: fit-content;
+ transition: color 200ms ease 0ms;
}
.link:hover,
@@ -3523,6 +3556,7 @@ initialize {
.link:hover {
background-color: unset;
+ color: inherit;
}
",
"next": null,
@@ -3558,6 +3592,7 @@ initialize {
padding: calc(0 * 0.8) calc(0 * 1.7);
border-radius: 0;
width: fit-content;
+ transition: color 200ms ease 0ms;
}
.link:hover,
@@ -3568,6 +3603,7 @@ initialize {
.link:hover {
background-color: unset;
+ color: inherit;
}
",
"next": null,
@@ -3914,6 +3950,7 @@ initialize {
padding: calc(0 * 0.8) calc(0 * 1.7);
border-radius: 0;
width: fit-content;
+ transition: color 200ms ease 0ms;
}
.link:hover,
@@ -3924,6 +3961,7 @@ initialize {
.link:hover {
background-color: unset;
+ color: inherit;
}
",
"next": null,
@@ -3959,6 +3997,7 @@ initialize {
padding: calc(0 * 0.8) calc(0 * 1.7);
border-radius: 0;
width: fit-content;
+ transition: color 200ms ease 0ms;
}
.link:hover,
@@ -3969,6 +4008,7 @@ initialize {
.link:hover {
background-color: unset;
+ color: inherit;
}
",
"next": null,
@@ -4103,6 +4143,7 @@ initialize {
padding: calc(0 * 0.8) calc(0 * 1.7);
border-radius: 0;
width: fit-content;
+ transition: color 200ms ease 0ms;
}
.link:hover,
@@ -4113,6 +4154,7 @@ initialize {
.link:hover {
background-color: unset;
+ color: inherit;
}
",
"next": null,
@@ -4148,6 +4190,7 @@ initialize {
padding: calc(0 * 0.8) calc(0 * 1.7);
border-radius: 0;
width: fit-content;
+ transition: color 200ms ease 0ms;
}
.link:hover,
@@ -4158,6 +4201,7 @@ initialize {
.link:hover {
background-color: unset;
+ color: inherit;
}
",
"next": null,
@@ -4463,6 +4507,7 @@ initialize {
padding: calc(0 * 0.8) calc(0 * 1.7);
border-radius: 0;
width: fit-content;
+ transition: color 200ms ease 0ms;
}
.link:hover,
@@ -4473,6 +4518,7 @@ initialize {
.link:hover {
background-color: unset;
+ color: inherit;
}
",
"next": null,
@@ -4508,6 +4554,7 @@ initialize {
padding: calc(0 * 0.8) calc(0 * 1.7);
border-radius: 0;
width: fit-content;
+ transition: color 200ms ease 0ms;
}
.link:hover,
@@ -4518,6 +4565,7 @@ initialize {
.link:hover {
background-color: unset;
+ color: inherit;
}
",
"next": null,
@@ -5406,6 +5454,7 @@ initialize {
padding: calc(0 * 0.8) calc(0 * 1.7);
border-radius: 0;
width: fit-content;
+ transition: color 200ms ease 0ms;
}
.link:hover,
@@ -5416,6 +5465,7 @@ initialize {
.link:hover {
background-color: unset;
+ color: inherit;
}
",
"next": null,
@@ -5451,6 +5501,7 @@ initialize {
padding: calc(0 * 0.8) calc(0 * 1.7);
border-radius: 0;
width: fit-content;
+ transition: color 200ms ease 0ms;
}
.link:hover,
@@ -5461,6 +5512,7 @@ initialize {
.link:hover {
background-color: unset;
+ color: inherit;
}
",
"next": null,
@@ -5595,6 +5647,7 @@ initialize {
padding: calc(0 * 0.8) calc(0 * 1.7);
border-radius: 0;
width: fit-content;
+ transition: color 200ms ease 0ms;
}
.link:hover,
@@ -5605,6 +5658,7 @@ initialize {
.link:hover {
background-color: unset;
+ color: inherit;
}
",
"next": null,
@@ -5640,6 +5694,7 @@ initialize {
padding: calc(0 * 0.8) calc(0 * 1.7);
border-radius: 0;
width: fit-content;
+ transition: color 200ms ease 0ms;
}
.link:hover,
@@ -5650,6 +5705,7 @@ initialize {
.link:hover {
background-color: unset;
+ color: inherit;
}
",
"next": null,
@@ -5955,6 +6011,7 @@ initialize {
padding: calc(0 * 0.8) calc(0 * 1.7);
border-radius: 0;
width: fit-content;
+ transition: color 200ms ease 0ms;
}
.link:hover,
@@ -5965,6 +6022,7 @@ initialize {
.link:hover {
background-color: unset;
+ color: inherit;
}
",
"next": null,
@@ -6000,6 +6058,7 @@ initialize {
padding: calc(0 * 0.8) calc(0 * 1.7);
border-radius: 0;
width: fit-content;
+ transition: color 200ms ease 0ms;
}
.link:hover,
@@ -6010,6 +6069,7 @@ initialize {
.link:hover {
background-color: unset;
+ color: inherit;
}
",
"next": null,
@@ -6356,6 +6416,7 @@ initialize {
padding: calc(0 * 0.8) calc(0 * 1.7);
border-radius: 0;
width: fit-content;
+ transition: color 200ms ease 0ms;
}
.link:hover,
@@ -6366,6 +6427,7 @@ initialize {
.link:hover {
background-color: unset;
+ color: inherit;
}
",
"next": null,
@@ -6401,6 +6463,7 @@ initialize {
padding: calc(0 * 0.8) calc(0 * 1.7);
border-radius: 0;
width: fit-content;
+ transition: color 200ms ease 0ms;
}
.link:hover,
@@ -6411,6 +6474,7 @@ initialize {
.link:hover {
background-color: unset;
+ color: inherit;
}
",
"next": null,
@@ -6545,6 +6609,7 @@ initialize {
padding: calc(0 * 0.8) calc(0 * 1.7);
border-radius: 0;
width: fit-content;
+ transition: color 200ms ease 0ms;
}
.link:hover,
@@ -6555,6 +6620,7 @@ initialize {
.link:hover {
background-color: unset;
+ color: inherit;
}
",
"next": null,
@@ -6590,6 +6656,7 @@ initialize {
padding: calc(0 * 0.8) calc(0 * 1.7);
border-radius: 0;
width: fit-content;
+ transition: color 200ms ease 0ms;
}
.link:hover,
@@ -6600,6 +6667,7 @@ initialize {
.link:hover {
background-color: unset;
+ color: inherit;
}
",
"next": null,
@@ -6905,6 +6973,7 @@ initialize {
padding: calc(0 * 0.8) calc(0 * 1.7);
border-radius: 0;
width: fit-content;
+ transition: color 200ms ease 0ms;
}
.link:hover,
@@ -6915,6 +6984,7 @@ initialize {
.link:hover {
background-color: unset;
+ color: inherit;
}
",
"next": null,
@@ -6950,6 +7020,7 @@ initialize {
padding: calc(0 * 0.8) calc(0 * 1.7);
border-radius: 0;
width: fit-content;
+ transition: color 200ms ease 0ms;
}
.link:hover,
@@ -6960,6 +7031,7 @@ initialize {
.link:hover {
background-color: unset;
+ color: inherit;
}
",
"next": null,
diff --git a/components/image/image-browser.tsx b/components/image/image-browser.tsx
index 48ad2ba..14f5e1a 100644
--- a/components/image/image-browser.tsx
+++ b/components/image/image-browser.tsx
@@ -47,7 +47,7 @@ const getAddressInput = (url: string, showFullLink: boolean, colors: BrowserColo
-
+
{showFullLink ? url : getHostFromUrl(url)}
linklinklinklinklinklinklink"
`;
diff --git a/components/link/__tests__/index.test.tsx b/components/link/__tests__/index.test.tsx
index d65c4cd..3c48d35 100644
--- a/components/link/__tests__/index.test.tsx
+++ b/components/link/__tests__/index.test.tsx
@@ -10,7 +10,7 @@ describe('Link', () => {
link
-
+
link
@@ -41,5 +41,13 @@ describe('Link', () => {
expect(errorSpy).not.toHaveBeenCalled()
expect(ref.current).not.toBeNull()
expect(() => wrapper.unmount()).not.toThrow()
+ errorSpy.mockRestore()
+ })
+
+ it('an warning should be thrown when using the pure prop', () => {
+ const errorSpy = jest.spyOn(console, 'error').mockImplementation(() => {})
+ mount()
+ expect(errorSpy).toHaveBeenCalled()
+ errorSpy.mockRestore()
})
})
diff --git a/components/link/icon.tsx b/components/link/icon.tsx
index 2c945d3..59c2774 100644
--- a/components/link/icon.tsx
+++ b/components/link/icon.tsx
@@ -1,10 +1,6 @@
import React from 'react'
-interface Props {
- color?: string
-}
-
-export const LinkIcon: React.FC = ({ color }) => {
+export const LinkIcon: React.FC<{}> = () => {
return (
diff --git a/components/link/link.tsx b/components/link/link.tsx
index 947e068..39cb172 100644
--- a/components/link/link.tsx
+++ b/components/link/link.tsx
@@ -1,12 +1,14 @@
import React from 'react'
import withDefaults from '../utils/with-defaults'
import useTheme from '../styles/use-theme'
+import useWarning from '../utils/use-warning'
import LinkIcon from './icon'
interface Props {
href?: string
color?: boolean
pure?: boolean
+ icon?: boolean
underline?: boolean
block?: boolean
className?: string
@@ -16,6 +18,7 @@ const defaultProps = {
href: '',
color: false,
pure: false,
+ icon: false,
underline: false,
block: false,
className: '',
@@ -26,18 +29,22 @@ export type LinkProps = Props & typeof defaultProps & NativeAttrs
const Link = React.forwardRef>(
(
- { href, color, underline, pure, children, className, block, ...props },
+ { href, color, underline, pure, children, className, block, icon, ...props },
ref: React.Ref,
) => {
const theme = useTheme()
const linkColor = color || block ? theme.palette.link : 'inherit'
+ const hoverColor = color || block ? theme.palette.successLight : 'inherit'
const padding = block ? theme.layout.gapQuarter : '0'
const decoration = underline ? 'underline' : 'none'
+ if (pure) {
+ useWarning('Props "pure" is deprecated, now the default Link is pure.')
+ }
return (
{children}
- {!pure && }
+ {icon && }
diff --git a/components/user/user-link.tsx b/components/user/user-link.tsx
index 3d636e9..7cd4b71 100644
--- a/components/user/user-link.tsx
+++ b/components/user/user-link.tsx
@@ -18,7 +18,7 @@ const UserLink = React.forwardRef) => {
return (
-
+
{children}