Put border around lists

This commit is contained in:
Andrew Nicolaou 2019-11-10 19:35:44 +01:00
parent 161725cb28
commit ff86e45e0a
5 changed files with 52 additions and 47 deletions

View file

@ -354,8 +354,6 @@ class Collection extends React.Component {
} }
</h2> </h2>
<p className="collection-metadata__user">By {owner.username}</p>
<p className="collection-metadata__description"> <p className="collection-metadata__description">
{ {
this.isOwner() ? this.isOwner() ?
@ -368,6 +366,8 @@ class Collection extends React.Component {
} }
</p> </p>
<p className="collection-metadata__user">Collection by {owner.username}</p>
<p className="collection-metadata__user">{items.length} sketch{items.length === 1 ? '' : 'es'}</p> <p className="collection-metadata__user">{items.length} sketch{items.length === 1 ? '' : 'es'}</p>
</div> </div>
@ -404,7 +404,7 @@ class Collection extends React.Component {
const hasCollectionItems = this.props.collection != null && this.props.collection.items.length > 0; const hasCollectionItems = this.props.collection != null && this.props.collection.items.length > 0;
if (!isLoading && !hasCollectionItems) { if (!isLoading && !hasCollectionItems) {
return (<p className="sketches-table__empty">No sketches in collection</p>); return (<p className="collection-empty-message">No sketches in collection</p>);
} }
return null; return null;
} }
@ -434,37 +434,35 @@ class Collection extends React.Component {
const title = this.hasCollection() ? this.getCollectionName() : null; const title = this.hasCollection() ? this.getCollectionName() : null;
return ( return (
<section className="collection-container"> <section className="collection-container" data-has-items={this.hasCollectionItems() ? 'true' : 'false'}>
<Helmet> <Helmet>
<title>{this.getTitle()}</title> <title>{this.getTitle()}</title>
</Helmet> </Helmet>
<div className=""> {this._renderLoader()}
{this._renderLoader()} {this.hasCollection() && this._renderCollectionMetadata()}
{this.hasCollection() && this._renderCollectionMetadata()} <div className="collection-table-wrapper">
{this._renderEmptyTable()} {this._renderEmptyTable()}
{this.hasCollectionItems() && {this.hasCollectionItems() &&
<div className="collection-table-wrapper"> <table className="sketches-table" summary="table containing all collections">
<table className="sketches-table" summary="table containing all collections"> <thead>
<thead> <tr>
<tr> {this._renderFieldHeader('name', 'Name')}
{this._renderFieldHeader('name', 'Name')} {this._renderFieldHeader('createdAt', 'Date Added')}
{this._renderFieldHeader('createdAt', 'Date Added')} {this._renderFieldHeader('user', 'Owner')}
{this._renderFieldHeader('user', 'Owner')} <th scope="col"></th>
<th scope="col"></th> </tr>
</tr> </thead>
</thead> <tbody>
<tbody> {this.props.collection.items.map(item =>
{this.props.collection.items.map(item => (<CollectionItemRow
(<CollectionItemRow key={item.id}
key={item.id} item={item}
item={item} user={this.props.user}
user={this.props.user} username={this.getUsername()}
username={this.getUsername()} collection={this.props.collection}
collection={this.props.collection} />))}
/>))} </tbody>
</tbody> </table>
</table>
</div>
} }
{ {
this.state.isAddingSketches && ( this.state.isAddingSketches && (

View file

@ -1,15 +1,11 @@
.collection-container { .collection-container {
width: 1012px;
margin: 0 auto;
} }
.collection-metadata { .collection-metadata {
margin: 0px #{56 / $base-font-size}rem; margin: 0px #{56 / $base-font-size}rem;
padding: #{24 / $base-font-size}rem #{10 / $base-font-size}rem; padding: #{24 / $base-font-size}rem #{10 / $base-font-size}rem;
@include themify() {
background-color: getThemifyVariable('modal-background-color');
border-bottom: 1px dotted getThemifyVariable('modal-border-color');
}
} }
.collection-metadata__columns { .collection-metadata__columns {
@ -109,3 +105,22 @@
@extend %primary-button; @extend %primary-button;
flex-grow: 0; flex-grow: 0;
} }
.collection-table-wrapper {
min-height: 100%;
@include themify() {
border: 1px solid getThemifyVariable('modal-border-color');
}
}
[data-has-items=false] .collection-table-wrapper {
display: flex;
justify-content: center;
align-items: center;
}
.collection-empty-message {
text-align: center;
font-size: #{16 / $base-font-size}rem;
}

View file

@ -72,11 +72,6 @@
align-items: center; align-items: center;
margin-bottom: #{24 / $base-font-size}rem; margin-bottom: #{24 / $base-font-size}rem;
padding: #{24 / $base-font-size}rem #{10 / $base-font-size}rem; padding: #{24 / $base-font-size}rem #{10 / $base-font-size}rem;
@include themify() {
background-color: getThemifyVariable('modal-background-color');
border-bottom: 1px dotted getThemifyVariable('modal-border-color');
}
} }
.dashboard-header__actions > *:not(:first-child) { .dashboard-header__actions > *:not(:first-child) {

View file

@ -95,9 +95,6 @@
font-weight: normal; font-weight: normal;
} }
.sketches-table__row--is-add-mode {
cursor: pointer;
}
.sketch-list__dropdown-button { .sketch-list__dropdown-button {
width:#{25 / $base-font-size}rem; width:#{25 / $base-font-size}rem;
@ -124,10 +121,6 @@
right: calc(100% - 26px); right: calc(100% - 26px);
} }
.sketch-list__action-option {
}
.sketches-table__empty { .sketches-table__empty {
text-align: center; text-align: center;
font-size: #{16 / $base-font-size}rem; font-size: #{16 / $base-font-size}rem;

View file

@ -14,4 +14,8 @@
flex-direction: column; flex-direction: column;
flex: 1; flex: 1;
overflow: hidden; overflow: hidden;
@include themify() {
border: 1px solid getThemifyVariable('modal-border-color');
}
} }