Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

React/remove default unused link class #645

Merged
merged 3 commits into from
Jun 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions changelogs/link-remove-default-class.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
___DESCRIPTION___
Minor
Added
- (React) [Link, DecorativeLink] DP-12128: Remove unused default class. #645
10 changes: 6 additions & 4 deletions react/src/components/atoms/links/DecorativeLink/index.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';

import Icon from '../../icons/Icon';
import './style.css';

const DecorativeLink = (props) => {
const classes = ['ma__decorative-link'];
const classes = classNames({
'ma__decorative-link': true,
'ma__download-link': props.showFileIcon
});
let decIcon = null;
let title;
if (props.showFileIcon) {
classes.push('ma__download-link');
// eslint-disable-next-line no-bitwise
const getFileExtension = (filename) => filename.slice((filename.lastIndexOf('.') - 1 >>> 0) + 2);
let ext = getFileExtension(props.href);
Expand All @@ -34,10 +37,9 @@ const DecorativeLink = (props) => {
}
}
return(
<span className={classes.join(' ')}>
<span className={classes}>
<a
href={props.href}
className="js-clickable-link"
title={props.info || null}
>
{decIcon && <span className="ma__download-link--icon">{decIcon}&nbsp;</span>}{props.text}&nbsp;<Icon name="arrow" aria-hidden="true" />
Expand Down
3 changes: 1 addition & 2 deletions react/src/components/molecules/Link/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,12 @@ import { Icon } from '../../../index';
const Link = (props) => {
const icon = props.icon ? (<Icon name={props.icon} svgWidth={13.2} svgHeight={13.2} />) : '';
const classes = classNames({
'js-clickable-link': true,
[props.classes]: props.classes
});
return(
<a
href={props.href}
className={classes}
className={classes || null}
title={props.info}
>{ (props.children) ? props.children : props.text }&nbsp;{ icon }
</a>
Expand Down