Skip to content

Commit f5f0248

Browse files
committed
💄 format dates for mobile, limit <td /> width
1 parent aa0ab1a commit f5f0248

File tree

5 files changed

+41
-34
lines changed

5 files changed

+41
-34
lines changed

client/modules/IDE/components/CollectionList/CollectionList.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import CollectionListRow from './CollectionListRow';
2121
import ArrowUpIcon from '../../../../images/sort-arrow-up.svg';
2222
import ArrowDownIcon from '../../../../images/sort-arrow-down.svg';
2323

24+
2425
class CollectionList extends React.Component {
2526
constructor(props) {
2627
super(props);
@@ -143,7 +144,7 @@ class CollectionList extends React.Component {
143144
<tr>
144145
{this._renderFieldHeader('name', 'Name')}
145146
{(!mobile) && this._renderFieldHeader('createdAt', 'Date Created')}
146-
{(!mobile) && this._renderFieldHeader('updatedAt', 'Date Updated')}
147+
{this._renderFieldHeader('updatedAt', 'Date Updated')}
147148
{this._renderFieldHeader('numItems', '# sketches')}
148149
<th scope="col"></th>
149150
</tr>

client/modules/IDE/components/CollectionList/CollectionListRow.jsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import * as ToastActions from '../../actions/toast';
1111

1212
import DownFilledTriangleIcon from '../../../../images/down-filled-triangle.svg';
1313

14+
const formatDateCell = (date, mobile = false) => format(new Date(date), 'MMM D, YYYY');
15+
1416
class CollectionListRowBase extends React.Component {
1517
static projectInCollection(project, collection) {
1618
return collection.items.find(item => item.project.id === project.id) != null;
@@ -212,7 +214,7 @@ class CollectionListRowBase extends React.Component {
212214
</span>
213215
</th>
214216
{(!mobile) && <td>{format(new Date(collection.createdAt), 'MMM D, YYYY')}</td>}
215-
{(!mobile) && <td>{format(new Date(collection.updatedAt), 'MMM D, YYYY')}</td>}
217+
<td>{formatDateCell(collection.updatedAt)}</td>
216218
<td>{(collection.items || []).length}</td>
217219
<td className="sketch-list__dropdown-column">
218220
{this.renderActions()}

client/modules/IDE/components/SketchList.jsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ import ArrowUpIcon from '../../../images/sort-arrow-up.svg';
2222
import ArrowDownIcon from '../../../images/sort-arrow-down.svg';
2323
import DownFilledTriangleIcon from '../../../images/down-filled-triangle.svg';
2424

25+
26+
const formatDateCell = (date, mobile = false) =>
27+
format(new Date(date), mobile ? 'MMM D, YYYY' : 'MMM D, YYYY h:mm A')
28+
.replace(', ', mobile ? '\n' : ', ');
29+
2530
class SketchListRowBase extends React.Component {
2631
constructor(props) {
2732
super(props);
@@ -288,8 +293,8 @@ class SketchListRowBase extends React.Component {
288293
<th scope="row">
289294
{name}
290295
</th>
291-
{(!mobile) && <td>{format(new Date(sketch.createdAt), 'MMM D, YYYY h:mm A')}</td>}
292-
<td>{format(new Date(sketch.updatedAt), 'MMM D, YYYY h:mm A')}</td>
296+
<td>{formatDateCell(sketch.createdAt, mobile)}</td>
297+
<td>{formatDateCell(sketch.updatedAt, mobile)}</td>
293298
{this.renderDropdown()}
294299
</tr>
295300
</React.Fragment>);
@@ -432,7 +437,7 @@ class SketchList extends React.Component {
432437
<thead>
433438
<tr>
434439
{this._renderFieldHeader('name', 'Sketch')}
435-
{(!mobile) && this._renderFieldHeader('createdAt', 'Date Created')}
440+
{this._renderFieldHeader('createdAt', 'Date Created')}
436441
{this._renderFieldHeader('updatedAt', 'Date Updated')}
437442
<th scope="col"></th>
438443
</tr>

client/modules/Mobile/MobileDashboardView.jsx

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,32 @@ import Button from '../../common/Button';
1919

2020
const EXAMPLE_USERNAME = 'p5';
2121

22+
const ContentWrapper = styled(Content)`
23+
td,thead button {
24+
font-size: ${remSize(10)};
25+
padding-left: 0;
26+
text-align: left;
27+
};
28+
29+
thead th { padding-left: 0; }
30+
31+
tbody th {
32+
font-size: ${remSize(12)};
33+
/* font-weight: bold; */
34+
width: 100%;
35+
max-width: 70%;
36+
};
37+
38+
.sketch-list__sort-button { padding: 0 }
39+
.sketches-table__row {
40+
height: ${remSize(48)};
41+
}
42+
43+
.sketches-table-container { padding-bottom: ${remSize(160)} }
44+
45+
/* td.sketch-list__dropdown-column { min-width: unset; } */
46+
`;
47+
2248
const FooterTab = styled(Link)`
2349
background: ${props => prop(props.selected ? 'backgroundColor' : 'MobilePanel.default.foreground')};
2450
color: ${props => prop(`MobilePanel.default.${props.selected ? 'foreground' : 'background'}`)};
@@ -90,14 +116,14 @@ const MobileDashboard = ({ params, location }) => {
90116
</Header>
91117

92118

93-
<Content slimheader>
119+
<ContentWrapper slimheader>
94120
<Subheader>
95121
{isOwner(user, params) && <SubheaderButton to={getCreatePathname(panel, username)}>new</SubheaderButton>}
96122
{panel === Tabs[0] && <SketchSearchbar />}
97123
{panel === Tabs[1] && <CollectionSearchbar />}
98124
</Subheader>
99125
{renderPanel(panel, { username, key: pathname })}
100-
</Content>
126+
</ContentWrapper>
101127
<Footer>
102128
{!isExamples &&
103129
<FooterTabSwitcher>

client/modules/Mobile/MobileViewContent.jsx

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -7,31 +7,4 @@ export default styled.div`
77
/* Dashboard Styles */
88
z-index: 0;
99
margin-top: ${props => remSize(props.slimheader ? 50 : 68)};
10-
11-
12-
13-
/* Dashboard Styles */
14-
15-
16-
td {
17-
font-size: ${remSize(10)};
18-
min-width: ${remSize(72)};
19-
};
20-
tbody th {
21-
font-size: ${remSize(14)};
22-
/* font-weight: bold; */
23-
width: 100%;
24-
/* max-width: ${remSize(280)}; */
25-
26-
27-
};
28-
29-
.sketch-list__sort-button { padding: 0 }
30-
.sketches-table__row {
31-
height: ${remSize(48)};
32-
}
33-
34-
.sketches-table-container { padding-bottom: ${remSize(160)} }
35-
36-
td.sketch-list__dropdown-column { min-width: unset; }
3710
`;

0 commit comments

Comments
 (0)