💄 format dates for mobile, limit <td /> width
This commit is contained in:
parent
aa0ab1a960
commit
f5f02488c6
5 changed files with 41 additions and 34 deletions
|
@ -21,6 +21,7 @@ import CollectionListRow from './CollectionListRow';
|
||||||
import ArrowUpIcon from '../../../../images/sort-arrow-up.svg';
|
import ArrowUpIcon from '../../../../images/sort-arrow-up.svg';
|
||||||
import ArrowDownIcon from '../../../../images/sort-arrow-down.svg';
|
import ArrowDownIcon from '../../../../images/sort-arrow-down.svg';
|
||||||
|
|
||||||
|
|
||||||
class CollectionList extends React.Component {
|
class CollectionList extends React.Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
|
@ -143,7 +144,7 @@ class CollectionList extends React.Component {
|
||||||
<tr>
|
<tr>
|
||||||
{this._renderFieldHeader('name', 'Name')}
|
{this._renderFieldHeader('name', 'Name')}
|
||||||
{(!mobile) && this._renderFieldHeader('createdAt', 'Date Created')}
|
{(!mobile) && this._renderFieldHeader('createdAt', 'Date Created')}
|
||||||
{(!mobile) && this._renderFieldHeader('updatedAt', 'Date Updated')}
|
{this._renderFieldHeader('updatedAt', 'Date Updated')}
|
||||||
{this._renderFieldHeader('numItems', '# sketches')}
|
{this._renderFieldHeader('numItems', '# sketches')}
|
||||||
<th scope="col"></th>
|
<th scope="col"></th>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
@ -11,6 +11,8 @@ import * as ToastActions from '../../actions/toast';
|
||||||
|
|
||||||
import DownFilledTriangleIcon from '../../../../images/down-filled-triangle.svg';
|
import DownFilledTriangleIcon from '../../../../images/down-filled-triangle.svg';
|
||||||
|
|
||||||
|
const formatDateCell = (date, mobile = false) => format(new Date(date), 'MMM D, YYYY');
|
||||||
|
|
||||||
class CollectionListRowBase extends React.Component {
|
class CollectionListRowBase extends React.Component {
|
||||||
static projectInCollection(project, collection) {
|
static projectInCollection(project, collection) {
|
||||||
return collection.items.find(item => item.project.id === project.id) != null;
|
return collection.items.find(item => item.project.id === project.id) != null;
|
||||||
|
@ -212,7 +214,7 @@ class CollectionListRowBase extends React.Component {
|
||||||
</span>
|
</span>
|
||||||
</th>
|
</th>
|
||||||
{(!mobile) && <td>{format(new Date(collection.createdAt), 'MMM D, YYYY')}</td>}
|
{(!mobile) && <td>{format(new Date(collection.createdAt), 'MMM D, YYYY')}</td>}
|
||||||
{(!mobile) && <td>{format(new Date(collection.updatedAt), 'MMM D, YYYY')}</td>}
|
<td>{formatDateCell(collection.updatedAt)}</td>
|
||||||
<td>{(collection.items || []).length}</td>
|
<td>{(collection.items || []).length}</td>
|
||||||
<td className="sketch-list__dropdown-column">
|
<td className="sketch-list__dropdown-column">
|
||||||
{this.renderActions()}
|
{this.renderActions()}
|
||||||
|
|
|
@ -22,6 +22,11 @@ import ArrowUpIcon from '../../../images/sort-arrow-up.svg';
|
||||||
import ArrowDownIcon from '../../../images/sort-arrow-down.svg';
|
import ArrowDownIcon from '../../../images/sort-arrow-down.svg';
|
||||||
import DownFilledTriangleIcon from '../../../images/down-filled-triangle.svg';
|
import DownFilledTriangleIcon from '../../../images/down-filled-triangle.svg';
|
||||||
|
|
||||||
|
|
||||||
|
const formatDateCell = (date, mobile = false) =>
|
||||||
|
format(new Date(date), mobile ? 'MMM D, YYYY' : 'MMM D, YYYY h:mm A')
|
||||||
|
.replace(', ', mobile ? '\n' : ', ');
|
||||||
|
|
||||||
class SketchListRowBase extends React.Component {
|
class SketchListRowBase extends React.Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
|
@ -288,8 +293,8 @@ class SketchListRowBase extends React.Component {
|
||||||
<th scope="row">
|
<th scope="row">
|
||||||
{name}
|
{name}
|
||||||
</th>
|
</th>
|
||||||
{(!mobile) && <td>{format(new Date(sketch.createdAt), 'MMM D, YYYY h:mm A')}</td>}
|
<td>{formatDateCell(sketch.createdAt, mobile)}</td>
|
||||||
<td>{format(new Date(sketch.updatedAt), 'MMM D, YYYY h:mm A')}</td>
|
<td>{formatDateCell(sketch.updatedAt, mobile)}</td>
|
||||||
{this.renderDropdown()}
|
{this.renderDropdown()}
|
||||||
</tr>
|
</tr>
|
||||||
</React.Fragment>);
|
</React.Fragment>);
|
||||||
|
@ -432,7 +437,7 @@ class SketchList extends React.Component {
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
{this._renderFieldHeader('name', 'Sketch')}
|
{this._renderFieldHeader('name', 'Sketch')}
|
||||||
{(!mobile) && this._renderFieldHeader('createdAt', 'Date Created')}
|
{this._renderFieldHeader('createdAt', 'Date Created')}
|
||||||
{this._renderFieldHeader('updatedAt', 'Date Updated')}
|
{this._renderFieldHeader('updatedAt', 'Date Updated')}
|
||||||
<th scope="col"></th>
|
<th scope="col"></th>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
@ -19,6 +19,32 @@ import Button from '../../common/Button';
|
||||||
|
|
||||||
const EXAMPLE_USERNAME = 'p5';
|
const EXAMPLE_USERNAME = 'p5';
|
||||||
|
|
||||||
|
const ContentWrapper = styled(Content)`
|
||||||
|
td,thead button {
|
||||||
|
font-size: ${remSize(10)};
|
||||||
|
padding-left: 0;
|
||||||
|
text-align: left;
|
||||||
|
};
|
||||||
|
|
||||||
|
thead th { padding-left: 0; }
|
||||||
|
|
||||||
|
tbody th {
|
||||||
|
font-size: ${remSize(12)};
|
||||||
|
/* font-weight: bold; */
|
||||||
|
width: 100%;
|
||||||
|
max-width: 70%;
|
||||||
|
};
|
||||||
|
|
||||||
|
.sketch-list__sort-button { padding: 0 }
|
||||||
|
.sketches-table__row {
|
||||||
|
height: ${remSize(48)};
|
||||||
|
}
|
||||||
|
|
||||||
|
.sketches-table-container { padding-bottom: ${remSize(160)} }
|
||||||
|
|
||||||
|
/* td.sketch-list__dropdown-column { min-width: unset; } */
|
||||||
|
`;
|
||||||
|
|
||||||
const FooterTab = styled(Link)`
|
const FooterTab = styled(Link)`
|
||||||
background: ${props => prop(props.selected ? 'backgroundColor' : 'MobilePanel.default.foreground')};
|
background: ${props => prop(props.selected ? 'backgroundColor' : 'MobilePanel.default.foreground')};
|
||||||
color: ${props => prop(`MobilePanel.default.${props.selected ? 'foreground' : 'background'}`)};
|
color: ${props => prop(`MobilePanel.default.${props.selected ? 'foreground' : 'background'}`)};
|
||||||
|
@ -90,14 +116,14 @@ const MobileDashboard = ({ params, location }) => {
|
||||||
</Header>
|
</Header>
|
||||||
|
|
||||||
|
|
||||||
<Content slimheader>
|
<ContentWrapper slimheader>
|
||||||
<Subheader>
|
<Subheader>
|
||||||
{isOwner(user, params) && <SubheaderButton to={getCreatePathname(panel, username)}>new</SubheaderButton>}
|
{isOwner(user, params) && <SubheaderButton to={getCreatePathname(panel, username)}>new</SubheaderButton>}
|
||||||
{panel === Tabs[0] && <SketchSearchbar />}
|
{panel === Tabs[0] && <SketchSearchbar />}
|
||||||
{panel === Tabs[1] && <CollectionSearchbar />}
|
{panel === Tabs[1] && <CollectionSearchbar />}
|
||||||
</Subheader>
|
</Subheader>
|
||||||
{renderPanel(panel, { username, key: pathname })}
|
{renderPanel(panel, { username, key: pathname })}
|
||||||
</Content>
|
</ContentWrapper>
|
||||||
<Footer>
|
<Footer>
|
||||||
{!isExamples &&
|
{!isExamples &&
|
||||||
<FooterTabSwitcher>
|
<FooterTabSwitcher>
|
||||||
|
|
|
@ -7,31 +7,4 @@ export default styled.div`
|
||||||
/* Dashboard Styles */
|
/* Dashboard Styles */
|
||||||
z-index: 0;
|
z-index: 0;
|
||||||
margin-top: ${props => remSize(props.slimheader ? 50 : 68)};
|
margin-top: ${props => remSize(props.slimheader ? 50 : 68)};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Dashboard Styles */
|
|
||||||
|
|
||||||
|
|
||||||
td {
|
|
||||||
font-size: ${remSize(10)};
|
|
||||||
min-width: ${remSize(72)};
|
|
||||||
};
|
|
||||||
tbody th {
|
|
||||||
font-size: ${remSize(14)};
|
|
||||||
/* font-weight: bold; */
|
|
||||||
width: 100%;
|
|
||||||
/* max-width: ${remSize(280)}; */
|
|
||||||
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
.sketch-list__sort-button { padding: 0 }
|
|
||||||
.sketches-table__row {
|
|
||||||
height: ${remSize(48)};
|
|
||||||
}
|
|
||||||
|
|
||||||
.sketches-table-container { padding-bottom: ${remSize(160)} }
|
|
||||||
|
|
||||||
td.sketch-list__dropdown-column { min-width: unset; }
|
|
||||||
`;
|
`;
|
||||||
|
|
Loading…
Reference in a new issue