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

Commit c638ba1

Browse files
author
Dmitry Yadrikhinsky
committed
[Hours] HoursCard hide button
1 parent abd3480 commit c638ba1

File tree

4 files changed

+39
-5
lines changed

4 files changed

+39
-5
lines changed

src/components/CircleButton/CircleButton.tsx

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,21 @@ import React from 'react';
22

33
import './CircleButton.less';
44

5-
export default function CircleButton({ children, onClick }) {
5+
import cn from '../../helpers/ClassNameHelper';
6+
7+
interface CircleButtonProps {
8+
className: string;
9+
onClick: () => void;
10+
children: React.ReactNode;
11+
}
12+
13+
export default function CircleButton({
14+
className,
15+
children,
16+
onClick,
17+
}: CircleButtonProps) {
618
return (
7-
<span className="circle-button" onClick={onClick}>
19+
<span className={cn('circle-button', className)} onClick={onClick}>
820
{children}
921
</span>
1022
);

src/helpers/ClassNameHelper.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
function cn(...classes: (string | undefined | null | boolean)[]) {
2+
return classes.filter((i) => !!i).join(' ');
3+
}
4+
5+
export default cn;

src/screens/hours/components/HoursCard/HoursCard.less

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,23 @@
22
width: 300px;
33
}
44

5-
.hours-card__icon {
5+
.hours-card .ant-card-body {
6+
display: flex;
7+
flex-direction: row;
8+
}
9+
10+
.hours-card__info {
11+
flex: 1;
12+
}
13+
14+
.hours-card__button {
15+
display: none;
16+
}
17+
18+
.hours-card:hover .hours-card__button {
19+
display: inline-flex;
20+
}
21+
22+
.anticon.hours-card__icon {
623
color: white;
724
}

src/screens/hours/components/HoursCard/HoursCard.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ export default observer(function HoursCard({ taskTime }: HoursCardProps) {
3737

3838
return (
3939
<Card className="hours-card">
40-
<div>
40+
<div className="hours-card__info">
4141
<div>{task.title}</div>
4242
<div>{`${timeFormat(time[0])} - ${timeFormat(time[1])}`}</div>
4343
</div>
44-
<CircleButton onClick={handleClick}>
44+
<CircleButton onClick={handleClick} className="hours-card__button">
4545
{!task.active ? (
4646
<CaretRightFilled className="hours-card__icon" />
4747
) : (

0 commit comments

Comments
 (0)