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

Commit 929eb17

Browse files
committed
JSS
1 parent be5ab52 commit 929eb17

File tree

35 files changed

+578
-323
lines changed

35 files changed

+578
-323
lines changed

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,7 @@
237237
"@ant-design/icons": "4.6.2",
238238
"antd": "4.15.0",
239239
"caniuse-lite": "1.0.30001214",
240+
"clsx": "^1.1.1",
240241
"date-fns": "2.20.1",
241242
"electron-debug": "^3.1.0",
242243
"electron-log": "^4.2.4",
@@ -250,6 +251,7 @@
250251
"moment": "2.29.1",
251252
"react": "^17.0.1",
252253
"react-dom": "^17.0.1",
254+
"react-jss": "^10.6.0",
253255
"react-router-dom": "^5.2.0",
254256
"regenerator-runtime": "^0.13.5",
255257
"source-map-support": "^0.5.19"

src/components/CircleButton/CircleButton.less

Lines changed: 0 additions & 10 deletions
This file was deleted.
Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
import React, { SyntheticEvent } from 'react';
22
import { observer } from 'mobx-react';
3-
4-
import './CircleButton.less';
5-
6-
import cn from '../../helpers/ClassNameHelper';
3+
import { createUseStyles } from 'react-jss';
4+
import clsx from 'clsx';
75

86
interface CircleButtonProps {
97
className?: string;
@@ -16,9 +14,24 @@ export default observer(function CircleButton({
1614
children,
1715
onClick,
1816
}: CircleButtonProps) {
17+
const classes = useStyles();
18+
1919
return (
20-
<span className={cn('circle-button', className)} onClick={onClick}>
20+
<span className={clsx(classes.circleButton, className)} onClick={onClick}>
2121
{children}
2222
</span>
2323
);
2424
});
25+
26+
const useStyles = createUseStyles({
27+
circleButton: {
28+
display: 'inline-flex',
29+
alignItems: 'center',
30+
justifyContent: 'center',
31+
height: 28,
32+
width: 28,
33+
borderRadius: 14,
34+
cursor: 'pointer',
35+
backgroundColor: 'black',
36+
},
37+
});

src/components/HeaderMenu/HeaderMenu.less

Lines changed: 0 additions & 7 deletions
This file was deleted.
Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,23 @@
11
import React from 'react';
22
import { observer } from 'mobx-react';
3-
4-
import './HeaderMenu.less';
3+
import { createUseStyles } from 'react-jss';
54

65
interface HeaderMenuProps {
76
children: React.ReactNode;
87
}
98

109
export default observer(function HeaderMenu({ children }: HeaderMenuProps) {
11-
return <span className="header-menu">{children}</span>;
10+
const classes = useStyles();
11+
12+
return <span className={classes.root}>{children}</span>;
13+
});
14+
15+
const useStyles = createUseStyles({
16+
root: {
17+
padding: '0 20px',
18+
19+
'& a': {
20+
color: 'white',
21+
},
22+
},
1223
});

src/components/IconTile/IconTile.less

Lines changed: 0 additions & 9 deletions
This file was deleted.

src/components/IconTile/IconTile.tsx

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import React from 'react';
22
import { observer } from 'mobx-react';
3-
4-
import './IconTile.less';
5-
import cn from '../../helpers/ClassNameHelper';
3+
import { createUseStyles } from 'react-jss';
4+
import clsx from 'clsx';
65

76
interface IconTileProps {
87
children: React.ReactNode;
@@ -15,9 +14,23 @@ export default observer(function IconTile({
1514
children,
1615
backgroundColor,
1716
}: IconTileProps) {
17+
const classes = useStyles();
18+
1819
return (
19-
<span className={cn('icon-tile', className)} style={{ backgroundColor }}>
20+
<span className={clsx(classes.root, className)} style={{ backgroundColor }}>
2021
{children}
2122
</span>
2223
);
2324
});
25+
26+
const useStyles = createUseStyles({
27+
root: {
28+
display: 'flex',
29+
justifyContent: 'center',
30+
alignItems: 'center',
31+
height: 30,
32+
width: 30,
33+
padding: 8,
34+
borderRadius: 5,
35+
},
36+
});

src/components/PlayStopButton/PlayStopButton.less

Lines changed: 0 additions & 3 deletions
This file was deleted.

src/components/PlayStopButton/PlayStopButton.tsx

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
import React, { SyntheticEvent } from 'react';
22
import { CaretRightFilled, PauseOutlined } from '@ant-design/icons';
33
import { observer } from 'mobx-react';
4-
5-
import './PlayStopButton.less';
4+
import clsx from 'clsx';
5+
import { createUseStyles } from 'react-jss';
66

77
import CircleButton from '../CircleButton/CircleButton';
88
import rootStore from '../../services/RootStore';
99
import TaskModel from '../../models/TaskModel';
10-
import cn from '../../helpers/ClassNameHelper';
1110

1211
const { tasksStore } = rootStore;
1312

@@ -20,6 +19,8 @@ export default observer(function PlayStopButton({
2019
task,
2120
className,
2221
}: PlayStopButtonProps) {
22+
const classes = useStyles();
23+
2324
function handleClick(e: SyntheticEvent) {
2425
e.stopPropagation();
2526
if (task) {
@@ -34,13 +35,19 @@ export default observer(function PlayStopButton({
3435
return (
3536
<CircleButton
3637
onClick={handleClick}
37-
className={cn('play-stop-button', className)}
38+
className={clsx('play-stop-button', className)}
3839
>
3940
{!task?.active ? (
40-
<CaretRightFilled className="play-stop-button__icon" />
41+
<CaretRightFilled className={classes.icon} />
4142
) : (
42-
<PauseOutlined className="play-stop-button__icon" />
43+
<PauseOutlined className={classes.icon} />
4344
)}
4445
</CircleButton>
4546
);
4647
});
48+
49+
const useStyles = createUseStyles({
50+
icon: {
51+
color: 'white',
52+
},
53+
});

src/components/TaskControl/TaskControl.less

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
border-radius: 5px;
1010
line-height: 16px;
1111
color: white;
12-
background-color: @purple;
12+
background-color: @purple; /* TODO refactor and use Theme */
1313
}
1414

1515
.task-control__info {

0 commit comments

Comments
 (0)