Skip to content

Commit

Permalink
Add private badge to repos list
Browse files Browse the repository at this point in the history
  • Loading branch information
tysongach authored and Greg Lazarev committed Jun 23, 2017
1 parent 2daf44a commit e640ebb
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 16 deletions.
14 changes: 8 additions & 6 deletions app/assets/javascripts/components/repo.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ class Repo extends React.Component {
render() {
const { isProcessingId, repo } = this.props;
const { active, id, name, price_in_cents } = repo;

const showPrivate = !active && price_in_cents > 0;
const showPrivate = price_in_cents > 0;

return (
<li
Expand All @@ -44,10 +43,13 @@ class Repo extends React.Component {
{name}
</div>

<div className={classNames(
"repo-activation-toggle",
{"repo-activation-toggle--private": showPrivate}
)}>
{ showPrivate &&
<span className="badge margin-left-small">
Private
</span>
}

<div className="repo-activation-toggle">
{this.renderButton()}
</div>
</li>
Expand Down
10 changes: 10 additions & 0 deletions app/assets/stylesheets/components/_badge.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.badge {
border: 1px solid $light-gray;
border-radius: 3px;
color: $base-font-color;
display: inline-block;
font-size: $font-size-small;
line-height: 1;
margin: 0;
padding: 0.125em 0.25em;
}
1 change: 1 addition & 0 deletions app/assets/stylesheets/components/_components.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
@import "allowance";
@import "app-nav";
@import "avatar";
@import "badge";
@import "button";
@import "code";
@import "footer";
Expand Down
11 changes: 2 additions & 9 deletions app/assets/stylesheets/pages/repos/_index.scss
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
.repo {
@include clearfix;
align-items: center;
border-top: 1px solid $base-border-color;
display: flex;
flex-direction: row;
justify-content: space-between;
padding: 1em;
position: relative;
width: 100%;

@include media($small-screen-only) {
display: block;
Expand All @@ -32,7 +29,7 @@
color: $medium-font-color;
font-size: 1.5em;
font-weight: $font-weight-light;
height: 100%;
line-height: 1;
padding-bottom: 2px;
transition: $base-transition;

Expand Down Expand Up @@ -60,10 +57,6 @@
}
}

.repo-activation-toggle--private {
min-width: 250px;
}

.repo-toggle {
background: rgba($purple, 0.1);
border: 2px solid $purple;
Expand Down
6 changes: 5 additions & 1 deletion app/assets/stylesheets/utilities/_margin.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
.margin-right-x-small {
margin-right: $xsmall-spacing;
margin-right: $xsmall-spacing !important;
}

.margin-left-small {
margin-left: $small-spacing !important;
}

0 comments on commit e640ebb

Please sign in to comment.