Skip to content
This repository was archived by the owner on Dec 26, 2022. It is now read-only.

Commit bdc071c

Browse files
author
Dmitry Yadrikhinsky
committed
Style of HoursByTask
1 parent 32f23d1 commit bdc071c

File tree

6 files changed

+87
-40
lines changed

6 files changed

+87
-40
lines changed

.erb/configs/webpack.config.renderer.dev.babel.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ export default merge(baseConfig, {
155155
lessOptions: {
156156
modifyVars: {
157157
'primary-color': 'purple',
158+
'border-radius-base': '5px',
158159
},
159160
javascriptEnabled: true,
160161
},
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
.icon-tile {
2+
display: flex;
3+
justify-content: center;
4+
align-items: center;
5+
height: 30px;
6+
width: 30px;
7+
padding: 8px;
8+
border-radius: 5px;
9+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import React from 'react';
2+
3+
import './IconTile.less';
4+
import cn from '../../helpers/ClassNameHelper';
5+
6+
interface IconTileProps {
7+
children: React.ReactNode;
8+
backgroundColor: string;
9+
className: string;
10+
}
11+
12+
export default function IconTile({
13+
className,
14+
children,
15+
backgroundColor,
16+
}: IconTileProps) {
17+
return (
18+
<span className={cn('icon-tile', className)} style={{ backgroundColor }}>
19+
{children}
20+
</span>
21+
);
22+
}
Lines changed: 32 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,40 @@
1+
.hours-by-task-container > .ant-card-body {
2+
border-left: 2px solid #F5AB28;
3+
padding: 8px;
4+
}
5+
16
.hours-by-task {
27
width: 100%;
3-
}
48

5-
.hours-by-task .label {
6-
margin-left: 8px;
7-
}
9+
.bell {
10+
//position: absolute;
11+
//right: 8px
12+
}
813

9-
.hours-item .ant-card-body {
10-
display: flex;
11-
flex-direction: row;
12-
justify-content: space-between;
13-
padding: 8px;
14-
}
14+
.label {
15+
margin-left: 8px;
16+
}
1517

16-
.space {
17-
flex: 1;
18-
}
18+
.hours-item .ant-card-body {
19+
display: flex;
20+
flex-direction: row;
21+
justify-content: space-between;
22+
padding: 8px;
23+
}
1924

20-
.hours-range {
21-
font-size: 10px;
22-
}
25+
.date {
26+
margin-left: 8px;
27+
font-size: 11px;
28+
font-weight: bold;
29+
}
30+
31+
.hours-range {
32+
font-size: 10px;
33+
}
34+
35+
.duration {
36+
font-size: 11px;
37+
font-weight: bold;
38+
}
2339

24-
.duration {
25-
font-size: 11px;
26-
font-weight: bold;
2740
}
Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
2-
import { Space } from 'antd';
3-
import { FieldTimeOutlined } from '@ant-design/icons';
2+
import { Card, Space } from 'antd';
3+
import { BellFilled } from '@ant-design/icons';
44
import isSameDay from 'date-fns/isSameDay';
55
import format from 'date-fns/format';
66

@@ -9,6 +9,7 @@ import './HoursByTask.less';
99
import TaskModel from '../../../../models/TaskModel';
1010
import { mapLastCurrent } from '../../../../helpers/IterateLastCurrent';
1111
import HoursItem from './HoursItem';
12+
import IconTile from '../../../../components/IconTile/IconTile';
1213

1314
function dateFormat(date: Date) {
1415
return format(date, 'dd.MM.yyyy');
@@ -20,23 +21,24 @@ interface HoursByTaskProps {
2021

2122
export default function HoursByTask({ task }: HoursByTaskProps) {
2223
return (
23-
<Space direction="vertical" className="hours-by-task">
24-
<div>
25-
<FieldTimeOutlined />
26-
<span className="label">Hours:</span>
27-
</div>
28-
{task?.time.length === 0 && <div>No billed hours</div>}
29-
{mapLastCurrent(task?.time || [], (last, range) => {
30-
if (!last || !isSameDay(last[0], range[0])) {
31-
return (
32-
<div>
33-
<div>{dateFormat(range[0])}</div>
34-
<HoursItem range={range} />
35-
</div>
36-
);
37-
}
38-
return <HoursItem range={range} />;
39-
})}
40-
</Space>
24+
<Card className="hours-by-task-container">
25+
<Space direction="vertical" className="hours-by-task">
26+
<IconTile backgroundColor="#F5AB28" className="bell">
27+
<BellFilled style={{ color: 'white' }} />
28+
</IconTile>
29+
{task?.time.length === 0 && <div>No billed hours</div>}
30+
{mapLastCurrent(task?.time || [], (last, range) => {
31+
if (!last || !isSameDay(last[0], range[0])) {
32+
return (
33+
<div>
34+
<div className="date">{dateFormat(range[0])}</div>
35+
<HoursItem range={range} />
36+
</div>
37+
);
38+
}
39+
return <HoursItem range={range} />;
40+
})}
41+
</Space>
42+
</Card>
4143
);
4244
}

src/screens/projects/components/HoursByTask/HoursItem.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export default function HoursItem({ range }: HoursItemProps) {
2929
return (
3030
<Card className="hours-item">
3131
<div className="hours-range">{hoursRangeFormat(range)}</div>
32-
<div className="space" />
32+
<div className="flex-1" />
3333
<div className="duration">{getDuration(range)}</div>
3434
</Card>
3535
);

0 commit comments

Comments
 (0)