Added more responsive improvements

This commit is contained in:
Alejandro Celaya 2018-08-05 08:49:07 +02:00
parent c1880125b3
commit b25cb6c170
7 changed files with 57 additions and 17 deletions

View file

@ -20,5 +20,9 @@
} }
.short-urls-container { .short-urls-container {
padding: 30px 30px 30px 20px; padding: 20px 0;
@media (min-width: $mdMin) {
padding: 30px 30px 30px 20px;
}
} }

View file

@ -135,7 +135,7 @@ export class ShortUrlsVisits extends React.Component {
{!loading && renderCreated()} {!loading && renderCreated()}
</div>} </div>}
<div> <div>
Original URL: Long URL:
&nbsp; &nbsp;
{loading && <small>Loading...</small>} {loading && <small>Loading...</small>}
{!loading && <a target="_blank" href={shortUrl.longUrl}>{shortUrl.longUrl}</a>} {!loading && <a target="_blank" href={shortUrl.longUrl}>{shortUrl.longUrl}</a>}

View file

@ -53,37 +53,37 @@ export class ShortUrlsList extends React.Component {
return ( return (
<table className="table table-striped table-hover"> <table className="table table-striped table-hover">
<thead> <thead className="short-urls-list__header">
<tr> <tr>
<th <th
className="short-urls-list__header short-urls-list__header--with-action" className="short-urls-list__header-cell short-urls-list__header-cell--with-action"
onClick={() => orderBy('dateCreated')} onClick={() => orderBy('dateCreated')}
> >
{renderOrderIcon('dateCreated')} {renderOrderIcon('dateCreated')}
Created at Created at
</th> </th>
<th <th
className="short-urls-list__header short-urls-list__header--with-action" className="short-urls-list__header-cell short-urls-list__header-cell--with-action"
onClick={() => orderBy('shortCode')} onClick={() => orderBy('shortCode')}
> >
{renderOrderIcon('shortCode')} {renderOrderIcon('shortCode')}
Short URL Short URL
</th> </th>
<th <th
className="short-urls-list__header short-urls-list__header--with-action" className="short-urls-list__header-cell short-urls-list__header-cell--with-action"
onClick={() => orderBy('originalUrl')} onClick={() => orderBy('originalUrl')}
> >
{renderOrderIcon('originalUrl')} {renderOrderIcon('originalUrl')}
Original URL Long URL
</th> </th>
<th className="short-urls-list__header">Tags</th> <th className="short-urls-list__header-cell">Tags</th>
<th <th
className="short-urls-list__header short-urls-list__header--with-action" className="short-urls-list__header-cell short-urls-list__header-cell--with-action"
onClick={() => orderBy('visits')} onClick={() => orderBy('visits')}
> >
<span className="nowrap">{renderOrderIcon('visits')} Visits</span> <span className="nowrap">{renderOrderIcon('visits')} Visits</span>
</th> </th>
<th className="short-urls-list__header">&nbsp;</th> <th className="short-urls-list__header-cell">&nbsp;</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>

View file

@ -1,3 +1,11 @@
@import "../utils/base";
.short-urls-list__header {
@media (max-width: $smMax) {
display: none;
}
}
.short-urls-list__header--with-action { .short-urls-list__header--with-action {
cursor: pointer; cursor: pointer;
} }

View file

@ -26,20 +26,21 @@ export class ShortUrlsRow extends React.Component {
return ( return (
<tr <tr
className="short-urls-row"
onMouseEnter={() => this.setState({displayMenu: true})} onMouseEnter={() => this.setState({displayMenu: true})}
onMouseLeave={() => this.setState({displayMenu: false})} onMouseLeave={() => this.setState({displayMenu: false})}
> >
<td className="nowrap short-urls-row__cell"> <td className="nowrap short-urls-row__cell" data-th="Created at: ">
<Moment format="YYYY-MM-DD HH:mm">{shortUrl.dateCreated}</Moment> <Moment format="YYYY-MM-DD HH:mm">{shortUrl.dateCreated}</Moment>
</td> </td>
<td className="short-urls-row__cell"> <td className="short-urls-row__cell" data-th="Short URL: ">
<a href={completeShortUrl} target="_blank">{completeShortUrl}</a> <a href={completeShortUrl} target="_blank">{completeShortUrl}</a>
</td> </td>
<td className="short-urls-row__cell short-urls-row__cell--break"> <td className="short-urls-row__cell short-urls-row__cell--break" data-th="Long URL: ">
<a href={shortUrl.originalUrl} target="_blank">{shortUrl.originalUrl}</a> <a href={shortUrl.originalUrl} target="_blank">{shortUrl.originalUrl}</a>
</td> </td>
<td className="short-urls-row__cell">{this.renderTags(shortUrl.tags)}</td> <td className="short-urls-row__cell" data-th="Tags: ">{this.renderTags(shortUrl.tags)}</td>
<td className="short-urls-row__cell text-right">{shortUrl.visitsCount}</td> <td className="short-urls-row__cell text-md-right" data-th="Visits: ">{shortUrl.visitsCount}</td>
<td className="short-urls-row__cell short-urls-row__cell--relative"> <td className="short-urls-row__cell short-urls-row__cell--relative">
<small <small
className="badge badge-warning short-urls-row__copy-hint" className="badge badge-warning short-urls-row__copy-hint"

View file

@ -1,7 +1,33 @@
@import "../../utils/base";
@import "../../utils/mixins/vertical-align"; @import "../../utils/mixins/vertical-align";
.short-urls-row__cell { .short-urls-row {
@media (max-width: $smMax) {
display: block;
margin-bottom: 10px;
border-bottom: 1px solid $lightGrey;
}
}
.short-urls-row__cell.short-urls-row__cell {
vertical-align: middle !important; vertical-align: middle !important;
@media (max-width: $smMax) {
display: block;
width: 100%;
position: relative;
padding: .5rem;
font-size: .9rem;
&:before {
content: attr(data-th);
font-weight: bold;
}
&:last-child {
display: none;
}
}
} }
.short-urls-row__cell--break { .short-urls-row__cell--break {
word-break: break-all; word-break: break-all;

View file

@ -2,7 +2,7 @@
// Breakpoints // Breakpoints
$xsMax: 575px; $xsMax: 575px;
$smMin: 576px; $smMin: 576px;
$smMax: 577px; $smMax: 767px;
$mdMin: 768px; $mdMin: 768px;
$mdMax: 991px; $mdMax: 991px;
$lgMin: 992px; $lgMin: 992px;
@ -12,6 +12,7 @@ $xlgMin: 1200px;
// Colors // Colors
$mainColor: #4696e5; $mainColor: #4696e5;
$lightHoverColor: #eee; $lightHoverColor: #eee;
$lightGrey: #ddd;
$dangerColor: #dc3545; $dangerColor: #dc3545;
// Misc // Misc