Skip to content

Commit

Permalink
Fixes #25600 - Migrate Icon to patternfly-react
Browse files Browse the repository at this point in the history
Remove Icon from foreman
Switch DocumentLinkContent to use patternfly-react Icon
  • Loading branch information
orrabin authored and ohadlevy committed Dec 26, 2018
1 parent 0a18082 commit a91f168
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 148 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ exports[`bookmarks empty state 1`] = `
tabindex="-1"
>
<span
class="glyphicon glyphicon-question-sign icon-black"
aria-hidden="true"
class="fa fa-question-circle"
/>
Documentation
</a>
Expand Down Expand Up @@ -119,7 +120,8 @@ exports[`bookmarks should show an error message if loading failed 1`] = `
tabindex="-1"
>
<span
class="glyphicon glyphicon-question-sign icon-black"
aria-hidden="true"
class="fa fa-question-circle"
/>
Documentation
</a>
Expand Down Expand Up @@ -204,7 +206,8 @@ exports[`bookmarks should show no bookmarks if server did not respond with any 1
tabindex="-1"
>
<span
class="glyphicon glyphicon-question-sign icon-black"
aria-hidden="true"
class="fa fa-question-circle"
/>
Documentation
</a>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,35 +1,13 @@
import React from 'react';
import { storiesOf } from '@storybook/react';
import { action } from '@storybook/addon-actions';
import DocumentationLink, { DocumentLinkContent } from './index';
import Story from '../../../../../../stories/components/Story';
import DocumentationLink from './index';

storiesOf('Components/DocumentationLink', module)
.add('Default', () => (
<Story>
<ul>
<DocumentationLink handleClick={action('Link was clicked')} href="#" />
</ul>
</Story>
))
.add('DocumentLinkContent wrapped in a button', () => (
<Story>
<button className="btn btn-default">
<DocumentLinkContent />
</button>
<button className="btn btn-primary">
<DocumentLinkContent />
</button>
<button className="btn btn-warning">
<DocumentLinkContent />
</button>
<button className="btn btn-danger">
<DocumentLinkContent />
</button>
</Story>
))
.add('DocumentLinkContent', () => (
<Story>
<DocumentLinkContent />
</Story>
));
storiesOf('Components/DocumentationLink', module).add('Default', () => (
<Story>
<ul>
<DocumentationLink handleClick={action('Link was clicked')} href="#" />
</ul>
</Story>
));
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ exports[`documentation links should have an external link to documentation 1`] =
key="documentationUrl"
onClick={[Function]}
>
<DocumentLinkContent>
Documentation
</DocumentLinkContent>
<Icon
name="question-circle"
type="fa"
/>
Documentation
</MenuItem>
`;
Original file line number Diff line number Diff line change
@@ -1,33 +1,23 @@
import React from 'react';
import PropTypes from 'prop-types';
import { MenuItem } from 'patternfly-react';
import Icon from '../Icon';
import { MenuItem, Icon } from 'patternfly-react';
import { newWindowOnClick } from '../../../common/helpers';
import { translate as __ } from '../../../../react_app/common/I18n';

export const DocumentLinkContent = ({ children }) => (
<React.Fragment>
<Icon type="question-sign" className="icon-black" />
const DocumentationLink = ({ href, children }) => (
<MenuItem key="documentationUrl" href={href} onClick={newWindowOnClick(href)}>
<Icon type="fa" name="question-circle" />
{` ${children}`}
</React.Fragment>
</MenuItem>
);

DocumentLinkContent.propTypes = {
DocumentationLink.propTypes = {
href: PropTypes.string.isRequired,
children: PropTypes.node,
};

DocumentLinkContent.defaultProps = {
DocumentationLink.defaultProps = {
children: __('Documentation'),
};

const DocumentationLink = ({ href }) => (
<MenuItem key="documentationUrl" href={href} onClick={newWindowOnClick(href)}>
<DocumentLinkContent />
</MenuItem>
);

DocumentationLink.propTypes = {
href: PropTypes.string.isRequired,
};

export default DocumentationLink;
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import EmptyStatePattern from './EmptyStatePattern';
import PrimaryActionButton from './EmptyStatePrimaryActionButton';
import SecondaryActionButtons from './EmptyStateSecondaryActionButtons';
import { defaultEmptyStatePropTypes } from './EmptyStatePropTypes';
import { DocumentLinkContent } from '../DocumentationLink';
import { translate as __ } from '../../../common/I18n';

const documentationBlock = ({
Expand All @@ -15,7 +14,7 @@ const documentationBlock = ({
<React.Fragment>
{label}{' '}
<a href={url} target="_blank" rel="noopener noreferrer">
<DocumentLinkContent>{buttonLabel}</DocumentLinkContent>
{buttonLabel}
</a>
</React.Fragment>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,7 @@ exports[`Default Empty State should render documentation when given a url 1`] =
rel="noopener noreferrer"
target="_blank"
>
<span
className="glyphicon glyphicon-question-sign icon-black"
/>
Documentation
Documentation
</a>
</p>
<div
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit a91f168

Please sign in to comment.