Pad buttons using margin on content instead of padding on container

Allows button-style progress bars to set width without having to
account for padding
This commit is contained in:
Alex Liebowitz 2017-01-16 00:29:28 -05:00
parent 70db4c937e
commit e9f00eec23
4 changed files with 14 additions and 23 deletions

View file

@ -178,7 +178,7 @@ export let FileActions = React.createClass({
const const
progress = this.state.fileInfo ? this.state.fileInfo.written_bytes / this.state.fileInfo.total_bytes * 100 : 0, progress = this.state.fileInfo ? this.state.fileInfo.written_bytes / this.state.fileInfo.total_bytes * 100 : 0,
label = this.state.fileInfo ? progress.toFixed(0) + '% complete' : 'Connecting...', label = this.state.fileInfo ? progress.toFixed(0) + '% complete' : 'Connecting...',
labelWithIcon = <span><Icon icon="icon-download" />{label}</span>; labelWithIcon = <span className="button__content"><Icon icon="icon-download" />{label}</span>;
linkBlock = linkBlock =
<div className="faux-button-block file-actions__download-status-bar"> <div className="faux-button-block file-actions__download-status-bar">

View file

@ -34,23 +34,19 @@ export let Link = React.createClass({
if (this.props.children) { // Custom content if (this.props.children) { // Custom content
content = this.props.children; content = this.props.children;
} else { } else {
content = ( content = [
<span> 'icon' in this.props ? <Icon icon={this.props.icon} fixed={true} /> : null,
{'icon' in this.props <span className="link-label">{this.props.label}</span>,
? <Icon icon={this.props.icon} fixed={true} /> 'badge' in this.props ? <span className="badge">{this.props.badge}</span> : null,
: null} ];
<span className="link-label">{this.props.label}</span>
{'badge' in this.props
? <span className="badge">{this.props.badge}</span>
: null}
</span>
);
} }
return ( return (
<a className={className} href={this.props.href || 'javascript:;'} title={this.props.title} <a className={className} href={this.props.href || 'javascript:;'} title={this.props.title}
onClick={this.handleClick} {... 'style' in this.props ? {style: this.props.style} : {}}> onClick={this.handleClick} {... 'style' in this.props ? {style: this.props.style} : {}}>
{content} {this.props.button
? <span className="button__content">{content}</span>
: content}
</a> </a>
); );
} }

View file

@ -177,27 +177,26 @@ input[type="text"], input[type="search"]
cursor: pointer; cursor: pointer;
} }
.button__content {
margin: 0 $padding-button;
}
.button-primary .button-primary
{ {
color: white; color: white;
background-color: $color-primary; background-color: $color-primary;
box-shadow: $default-box-shadow; box-shadow: $default-box-shadow;
padding: 0 $padding-button;
} }
.button-alt .button-alt
{ {
background-color: $color-bg-alt; background-color: $color-bg-alt;
box-shadow: $default-box-shadow; box-shadow: $default-box-shadow;
padding: 0 $padding-button;
} }
.button-cancel
{
padding: 0 $padding-button;
}
.button-text .button-text
{ {
@include text-link(); @include text-link();
display: inline-block;
} }
.button-text-help .button-text-help
{ {

View file

@ -9,15 +9,11 @@ $color-download: #444;
.file-actions__download-status-bar .file-actions__download-status-bar
{ {
padding-right: $padding-button;
padding-left: $padding-button;
position: relative; position: relative;
color: $color-download; color: $color-download;
} }
.file-actions__download-status-bar-overlay .file-actions__download-status-bar-overlay
{ {
padding-right: $padding-button;
padding-left: $padding-button;
background: $color-download; background: $color-download;
color: white; color: white;
position: absolute; position: absolute;