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

Fix icon spacing on home page #925

Merged
merged 1 commit into from
Jan 5, 2018
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
17 changes: 0 additions & 17 deletions src/renderer/component/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,6 @@ import PropTypes from 'prop-types';
import { formatCredits, formatFullPrice } from 'util/formatCredits';
import lbry from '../lbry.js';

// component/icon.js
export class Icon extends React.PureComponent {
static propTypes = {
icon: PropTypes.string.isRequired,
className: PropTypes.string,
fixed: PropTypes.bool,
};

render() {
const { fixed, className } = this.props;
const spanClassName = `icon ${'fixed' in this.props ? 'icon-fixed-width ' : ''}${
this.props.icon
} ${this.props.className || ''}`;
return <span className={spanClassName} />;
}
}

export class TruncatedText extends React.PureComponent {
static propTypes = {
lines: PropTypes.number,
Expand Down
4 changes: 2 additions & 2 deletions src/renderer/component/fileCard/view.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ class FileCard extends React.PureComponent {
</div>
<div className="card__subtitle">
<span className="card__indicators card--file-subtitle">
<FilePrice uri={uri} /> {isRewardContent && <Icon icon={icons.FEATURED} />}{' '}
{fileInfo && <Icon icon={icons.LOCAL} />}
<FilePrice uri={uri} /> {isRewardContent && <Icon icon={icons.FEATURED} leftPad />}{' '}
{fileInfo && <Icon icon={icons.LOCAL} leftPad />}
</span>
<span className="card--file-subtitle">
<UriIndicator uri={uri} link span smallCard />
Expand Down
3 changes: 2 additions & 1 deletion src/renderer/component/fileDownloadLink/view.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from 'react';
import { Icon, BusyMessage } from 'component/common';
import { BusyMessage } from 'component/common';
import Icon from 'component/icon';
import Link from 'component/link';

class FileDownloadLink extends React.PureComponent {
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/component/form.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import FormField from 'component/formField';
import { Icon } from 'component/common.js';
import Icon from 'component/icon';

let formFieldCounter = 0;

Expand Down
18 changes: 14 additions & 4 deletions src/renderer/component/icon/view.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import * as icons from 'constants/icons';
import classnames from 'classnames';

export default class Icon extends React.PureComponent {
static propTypes = {
Expand Down Expand Up @@ -30,10 +31,19 @@ export default class Icon extends React.PureComponent {
}

render() {
const className = this.getIconClass(),
title = this.getIconTitle();

const spanClassName = `icon ${className}${this.props.fixed ? ' icon-fixed-width ' : ''}`;
const { icon, fixed, className, leftPad } = this.props;
const iconClass = this.getIconClass();
const title = this.getIconTitle();

const spanClassName = classnames(
'icon',
iconClass,
{
'icon-fixed-width': fixed,
'icon--left-pad': leftPad,
},
className
);

return <span className={spanClassName} title={title} />;
}
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/component/inviteList/view.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { Icon } from 'component/common';
import Icon from 'component/icon';
import RewardLink from 'component/rewardLink';
import rewards from 'rewards.js';

Expand Down
2 changes: 1 addition & 1 deletion src/renderer/component/menu.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Icon } from './common.js';
import Icon from 'component/icon';
import Link from 'component/link';

export class DropDownMenuItem extends React.PureComponent {
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/component/uriIndicator/view.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { Icon } from 'component/common';
import Icon from 'component/icon';
import Link from 'component/link';
import lbryuri from 'lbryuri';
import classnames from 'classnames';
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/component/wunderbar/view.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import lbryuri from 'lbryuri.js';
import { Icon } from 'component/common.js';
import Icon from 'component/icon';
import { parseQueryParams } from 'util/query_params';

class WunderBar extends React.PureComponent {
Expand Down
3 changes: 2 additions & 1 deletion src/renderer/page/discover/view.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import React from 'react';
import ReactDOM from 'react-dom';
import lbryuri from 'lbryuri';
import FileCard from 'component/fileCard';
import { Icon, BusyMessage } from 'component/common.js';
import { BusyMessage } from 'component/common.js';
import Icon from 'component/icon';
import ToolTip from 'component/tooltip.js';
import SubHeader from 'component/subHeader';
import classnames from 'classnames';
Expand Down
3 changes: 2 additions & 1 deletion src/renderer/page/help/view.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import React from 'react';
import lbry from 'lbry.js';
import Link from 'component/link';
import SubHeader from 'component/subHeader';
import { BusyMessage, Icon } from 'component/common';
import { BusyMessage } from 'component/common';
import Icon from 'component/icon';

class HelpPage extends React.PureComponent {
constructor(props) {
Expand Down
4 changes: 4 additions & 0 deletions src/renderer/scss/_gui.scss
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ body {
text-align: center;
}

.icon--left-pad {
padding-left: 3px;
}

h2 {
font-size: 1.75em;
}
Expand Down