Skip to content

Commit 6a487c0

Browse files
committed
Enable Styled Components
1 parent 8e30c41 commit 6a487c0

27 files changed

+342
-183
lines changed

.eslintrc.cjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ module.exports = {
114114
'**/*.js',
115115
'**/*.cjs',
116116
'**/setupTests.ts',
117+
'**/testUtils.tsx'
117118
],
118119
rules: {
119120
'import/no-extraneous-dependencies': [

additional.d.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,11 @@
1+
import 'styled-components';
2+
import type {theme} from '@/src/style';
3+
14
declare module '*.module.css';
5+
6+
type CustomTheme = typeof theme;
7+
8+
declare module 'styled-components' {
9+
/* eslint-disable-next-line @typescript-eslint/consistent-type-definitions */
10+
export interface DefaultTheme extends CustomTheme {}
11+
}

app/index.css

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

app/layout.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type {ReactNode} from 'react';
22

33
import {StoreProvider} from '@/src/state/StoreProvider';
4-
import './index.css';
4+
import {StyledComponentsRegistry, ThemeProvider} from '@/src/style';
55

66
type Props = {
77
readonly children: ReactNode;
@@ -10,9 +10,13 @@ type Props = {
1010
export default function RootLayout({children}: Props) {
1111
return (
1212
<StoreProvider>
13-
<html lang="en" suppressHydrationWarning>
14-
<body>{children}</body>
15-
</html>
13+
<ThemeProvider>
14+
<html lang="en" suppressHydrationWarning>
15+
<body>
16+
<StyledComponentsRegistry>{children}</StyledComponentsRegistry>
17+
</body>
18+
</html>
19+
</ThemeProvider>
1620
</StoreProvider>
1721
);
1822
}

next.config.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ module.exports = withBundleAnalyzer({
99
reactStrictMode: true,
1010
swcMinify: true,
1111
distDir: 'build',
12-
output: process.env.PAGES_BUILD === 'true' ? 'export' : undefined,
1312
cleanDistDir: true,
13+
output: process.env.PAGES_BUILD === 'true' ? 'export' : undefined,
1414
basePath: process.env.PAGES_BUILD === 'true' ? '/ts-redux-next' : undefined,
15+
compiler: {
16+
styledComponents: true,
17+
},
1518
});

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
"start": "next start",
1010
"lint:code": "eslint src/ --ext .js,.jsx,.ts,.tsx",
1111
"fix:code": "run-s 'lint:code --fix'",
12-
"lint:style": "stylelint 'src/**/*.css'",
13-
"fix:style": "stylelint 'src/**/*.css' --fix",
12+
"lint:style": "stylelint 'src/**/*.{ts,tsx}'",
13+
"fix:style": "stylelint 'src/**/*.{ts,tsx}' --fix",
1414
"lint:tsc": "tsc --pretty --noEmit",
1515
"prepare": "is-ci || husky install",
1616
"test": "jest",
@@ -27,6 +27,7 @@
2727
"react-dom": "18.3.1",
2828
"react-redux": "9.1.2",
2929
"redux": "5.0.1",
30+
"styled-components": "^6.1.11",
3031
"uniqid": "5.4.0"
3132
},
3233
"devDependencies": {
@@ -59,13 +60,12 @@
5960
"npm-run-all2": "6.2.0",
6061
"postcss": "8.4.38",
6162
"postcss-preset-env": "9.5.13",
63+
"postcss-styled-syntax": "0.6.4",
6264
"prettier": "3.2.5",
6365
"redux-mock-store": "1.5.4",
6466
"stylelint": "16.5.0",
65-
"stylelint-config-prettier": "9.0.5",
6667
"stylelint-config-standard": "36.0.0",
6768
"stylelint-order": "6.0.4",
68-
"stylelint-prettier": "5.0.0",
6969
"typescript": "5.4.5"
7070
}
7171
}

0 commit comments

Comments
 (0)