Skip to content

Commit 79dad26

Browse files
committed
feat: CLink: add default rel attribute when target="_blank"
1 parent 4f96e17 commit 79dad26

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

src/CLink.js

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ const CLink = props => {
4444
<a
4545
href={href || '#'}
4646
className={classes}
47+
rel={rest.target === '_blank' && 'noopener norefferer'}
4748
{...rest}
4849
onClick={click}
4950
ref={innerRef}
@@ -63,17 +64,17 @@ CLink.propTypes = {
6364
to: PropTypes.oneOfType([PropTypes.object, PropTypes.string, PropTypes.func])
6465
};
6566

66-
CLink.sortAttributes = (attributesToSort) => {
67-
const attributes = {}
68-
const linkProps = {}
69-
Object.entries(attributesToSort || {}).forEach(([key, value]) => {
70-
if (Object.keys(CLink.propTypes).includes(key)) {
71-
linkProps[key] = value
72-
} else {
73-
attributes[key] = value
74-
}
75-
})
76-
return { linkProps, attributes }
77-
}
67+
// CLink.sortAttributes = (attributesToSort) => {
68+
// const attributes = {}
69+
// const linkProps = {}
70+
// Object.entries(attributesToSort || {}).forEach(([key, value]) => {
71+
// if (Object.keys(CLink.propTypes).includes(key)) {
72+
// linkProps[key] = value
73+
// } else {
74+
// attributes[key] = value
75+
// }
76+
// })
77+
// return { linkProps, attributes }
78+
// }
7879

7980
export default CLink

0 commit comments

Comments
 (0)