Skip to content

Commit d746831

Browse files
committed
Revert "client: migrate some styles to CSS module or CSS-in-JS"
This reverts commit ffcc5c8. Hit some visual regressions.
1 parent 7d8d107 commit d746831

24 files changed

+687
-2056
lines changed

client/config/webpack.config.dev.js

+1-25
Original file line numberDiff line numberDiff line change
@@ -23,31 +23,8 @@ module.exports = {
2323
},
2424
],
2525
},
26-
{
27-
test: /\.module\.s?css$/,
28-
use: [
29-
{
30-
loader: 'style-loader',
31-
},
32-
{
33-
loader: 'css-loader',
34-
options: {
35-
importLoaders: 1,
36-
sourceMap: true,
37-
modules: true,
38-
},
39-
},
40-
{
41-
loader: 'sass-loader',
42-
options: {
43-
sourceMap: true,
44-
},
45-
},
46-
],
47-
},
4826
{
4927
test: /\.s?css$/,
50-
exclude: /\.module\.s?css$/,
5128
use: [
5229
{
5330
loader: 'style-loader',
@@ -107,11 +84,10 @@ module.exports = {
10784
},
10885
entry: paths.appIndex,
10986
resolve: {
110-
extensions: ['.cjs', '.mjs', '.js', '.jsx', '.ts', '.tsx', '.scss', '.json'],
87+
extensions: ['.cjs', '.mjs', '.js', '.jsx', '.ts', '.tsx', '.json'],
11188
alias: {
11289
'@client': path.resolve('./client/src/javascript'),
11390
'@shared': path.resolve('./shared'),
114-
'@styles': path.resolve('./client/src/sass/modules'),
11591
},
11692
},
11793
output: {

client/config/webpack.config.prod.js

-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ module.exports = {
108108
alias: {
109109
'@client': path.resolve('./client/src/javascript'),
110110
'@shared': path.resolve('./shared'),
111-
'@styles': path.resolve('./client/src/sass/modules'),
112111
},
113112
},
114113
output: {

client/src/javascript/components/AppWrapper.tsx

+3-5
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ import WindowTitle from './general/WindowTitle';
1414
import LoadingOverlay from './general/LoadingOverlay';
1515
import LogoutButton from './sidebar/LogoutButton';
1616

17-
import AppWrapperStyles from '@styles/app-wrapper.module.scss';
18-
1917
interface AppWrapperProps {
2018
children: ReactNode;
2119
className?: string;
@@ -44,8 +42,8 @@ const AppWrapper: FC<AppWrapperProps> = observer((props: AppWrapperProps) => {
4442

4543
if (AuthStore.isAuthenticated && !ClientStatusStore.isConnected && ConfigStore.authMethod !== 'none') {
4644
overlay = (
47-
<div className={AppWrapperStyles['loading-overlay']}>
48-
<div className={AppWrapperStyles['entry-barrier']}>
45+
<div className="application__loading-overlay">
46+
<div className="application__entry-barrier">
4947
<LogoutButton className={css({position: 'absolute', left: '5px', top: '5px'})} />
5048
<ClientConnectionInterruption />
5149
</div>
@@ -58,7 +56,7 @@ const AppWrapper: FC<AppWrapperProps> = observer((props: AppWrapperProps) => {
5856
<WindowTitle />
5957
<TransitionGroup>
6058
{overlay != null ? (
61-
<CSSTransition timeout={{enter: 1000, exit: 1000}} classNames={AppWrapperStyles['loading-overlay']}>
59+
<CSSTransition timeout={{enter: 1000, exit: 1000}} classNames="application__loading-overlay">
6260
{overlay}
6361
</CSSTransition>
6462
) : null}

client/src/javascript/components/auth/AuthForm.tsx

+1-3
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ import {AccessLevel} from '@shared/schema/constants/Auth';
1010
import type {Credentials} from '@shared/schema/Auth';
1111
import type {ClientConnectionSettings} from '@shared/schema/ClientConnectionSettings';
1212

13-
import AppWrapperStyles from '@styles/app-wrapper.module.scss';
14-
1513
import ClientConnectionSettingsForm from '../general/connection-settings/ClientConnectionSettingsForm';
1614

1715
type LoginFormData = Pick<Credentials, 'username' | 'password'>;
@@ -31,7 +29,7 @@ const AuthForm: FC<AuthFormProps> = ({mode}: AuthFormProps) => {
3129
const isLoginMode = mode === 'login';
3230

3331
return (
34-
<div className={AppWrapperStyles['loading-overlay']}>
32+
<div className="application__entry-barrier">
3533
<Panel spacing="large">
3634
<Form
3735
onSubmit={(submission) => {

client/src/javascript/components/general/LoadingOverlay.tsx

+1-3
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ import {CheckmarkThick} from '@client/ui/icons';
66

77
import type {Dependencies} from '@client/stores/UIStore';
88

9-
import AppWrapperStyles from '@styles/app-wrapper.module.scss';
10-
119
import LoadingIndicator from './LoadingIndicator';
1210

1311
const ICONS = {
@@ -43,7 +41,7 @@ const LoadingOverlay: FC<{dependencies?: Dependencies}> = (props: {dependencies?
4341
const {dependencies} = props;
4442

4543
return (
46-
<div className={AppWrapperStyles['loading-overlay']}>
44+
<div className="application__loading-overlay">
4745
<LoadingIndicator inverse />
4846
{dependencies != null ? <LoadingDependencyList dependencies={dependencies} /> : null}
4947
</div>

client/src/javascript/components/general/form-elements/TextboxRepeater.tsx

+1-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import {css} from '@emotion/css';
21
import {FC, ReactNode, useRef, useState} from 'react';
32

43
import {AddMini, RemoveMini} from '@client/ui/icons';
@@ -55,12 +54,7 @@ const TextboxRepeater: FC<TextboxRepeaterProps> = ({defaultValues, id, label, pl
5554
defaultValue={textbox.value}
5655
label={index === 0 && label}
5756
placeholder={placeholder}
58-
wrapperClassName={css({
59-
'.icon': {
60-
height: '12px',
61-
width: '12px',
62-
},
63-
})}
57+
wrapperClassName="textbox-repeater"
6458
>
6559
<FormElementAddon
6660
onClick={() => {

client/src/javascript/typings.d.ts

-5
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,3 @@ declare module '*.md' {
77
declare module '@lingui/loader!*.json?raw-lingui' {
88
export const messages: Record<string, string[]>;
99
}
10-
11-
declare module '*.module.scss' {
12-
const classes: {[key: string]: string};
13-
export default classes;
14-
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import classnames from 'classnames';
2+
import {FC, ReactNode} from 'react';
3+
4+
interface ContainerProps {
5+
children: ReactNode;
6+
}
7+
8+
const Container: FC<ContainerProps> = ({children}: ContainerProps) => {
9+
const classes = classnames('container');
10+
return <div className={classes}>{children}</div>;
11+
};
12+
13+
export default Container;

client/src/javascript/ui/components/Overlay.tsx

+13-27
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {rgba} from 'polished';
1+
import classnames from 'classnames';
22
import {FC, MouseEvent, ReactNode} from 'react';
33

44
export interface OverlayProps {
@@ -17,32 +17,18 @@ const Overlay: FC<OverlayProps> = ({
1717
onContextMenu,
1818
isInteractive,
1919
isTransparent,
20-
}: OverlayProps) => (
21-
<div
22-
css={[
23-
{
24-
background: rgba('#1d2938', 0.95),
25-
bottom: 0,
26-
left: 0,
27-
position: 'fixed',
28-
right: 0,
29-
top: 0,
30-
zIndex: 100,
31-
},
32-
isInteractive || {
33-
pointerEvents: 'none',
34-
},
35-
isTransparent && {
36-
background: 'transparent',
37-
},
38-
additionalClassNames,
39-
]}
40-
onClickCapture={onClick}
41-
onContextMenuCapture={onContextMenu}
42-
>
43-
{children}
44-
</div>
45-
);
20+
}: OverlayProps) => {
21+
const classes = classnames('overlay', additionalClassNames, {
22+
'overlay--no-interaction': !isInteractive,
23+
'overlay--transparent': isTransparent,
24+
});
25+
26+
return (
27+
<div className={classes} onClickCapture={onClick} onContextMenuCapture={onContextMenu}>
28+
{children}
29+
</div>
30+
);
31+
};
4632

4733
Overlay.defaultProps = {
4834
additionalClassNames: undefined,

client/src/javascript/ui/index.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
export {default as Button} from './components/Button';
22
export {default as Checkbox} from './components/Checkbox';
3+
export {default as Container} from './components/Container';
34
export {default as ContextMenu} from './components/ContextMenu';
45
export {default as Form} from './components/Form';
56
export {default as FormElementAddon} from './components/FormElementAddon';

client/src/sass/base/_layout.scss

+5
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ body {
66
overflow: hidden;
77
}
88

9+
.container {
10+
height: 100%;
11+
width: 100%;
12+
}
13+
914
#app,
1015
.application,
1116
.application__view {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
@use '../tools/colors';
2+
3+
.application {
4+
&__loading-overlay {
5+
align-items: center;
6+
background: colors.$light-blue;
7+
display: flex;
8+
flex-direction: column;
9+
font-size: 0.8em;
10+
height: 100%;
11+
justify-content: center;
12+
left: 0;
13+
opacity: 1;
14+
position: fixed;
15+
top: 0;
16+
width: 100%;
17+
z-index: 1000;
18+
19+
&-exit {
20+
opacity: 1;
21+
transition: opacity 1s;
22+
23+
&-active {
24+
opacity: 0;
25+
}
26+
}
27+
}
28+
29+
&__entry-barrier {
30+
max-width: 500px;
31+
width: 100%;
32+
}
33+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.textbox-repeater {
2+
.icon {
3+
height: 12px;
4+
width: 12px;
5+
}
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
@use '../tools/colors';
2+
3+
$transfer-data--download: colors.$green;
4+
$transfer-data--upload: colors.$blue;
5+
6+
.transfer-data {
7+
&--download {
8+
color: $transfer-data--download;
9+
10+
.icon {
11+
fill: $transfer-data--download;
12+
}
13+
}
14+
15+
&--upload {
16+
color: $transfer-data--upload;
17+
18+
.icon {
19+
fill: $transfer-data--upload;
20+
}
21+
}
22+
}

client/src/sass/modules/app-wrapper.module.scss

-31
This file was deleted.

client/src/sass/style.scss

+3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
@import 'base/typography';
1515

1616
@import 'components/action-bar';
17+
@import 'components/app-wrapper';
1718
@import 'components/alerts';
1819
@import 'components/attached-panel';
1920
@import 'components/badge';
@@ -43,11 +44,13 @@
4344
@import 'components/sortable-list';
4445
@import 'components/table';
4546
@import 'components/tags';
47+
@import 'components/textbox-repeater';
4648
@import 'components/toolbar';
4749
@import 'components/tooltip';
4850
@import 'components/torrent-details-panel';
4951
@import 'components/torrents';
5052
@import 'components/torrent';
53+
@import 'components/transfer-data';
5154

5255
@import 'views/login';
5356
@import 'views/feeds';

client/src/sass/tools/_colors.scss

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ $grey--harder: harden($grey, 1);
3939

4040
$dark-grey: #34516c;
4141
$dark-grey--light: color.adjust($dark-grey, $lightness: 7%);
42+
$darker-grey: #1d2938;
4243
$darkest-grey: #28303b;
4344
$darkest-grey--hard: #293341;
4445
$darkest-grey--darker: #202d3c;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.container {
2+
max-width: 900px;
3+
}
+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
@use '../../tools/colors';
2+
3+
.overlay {
4+
background: rgba(colors.$darker-grey, 0.95);
5+
bottom: 0;
6+
left: 0;
7+
position: fixed;
8+
right: 0;
9+
top: 0;
10+
z-index: 100;
11+
12+
&--transparent {
13+
background: transparent;
14+
}
15+
16+
&--no-interaction {
17+
pointer-events: none;
18+
}
19+
}

0 commit comments

Comments
 (0)