Skip to content

Commit

Permalink
Enable Styled Components
Browse files Browse the repository at this point in the history
  • Loading branch information
morewings committed May 17, 2024
1 parent cd44270 commit 63422c3
Show file tree
Hide file tree
Showing 27 changed files with 342 additions and 183 deletions.
1 change: 1 addition & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ module.exports = {
'**/*.js',
'**/*.cjs',
'**/setupTests.ts',
'**/testUtils.tsx'
],
rules: {
'import/no-extraneous-dependencies': [
Expand Down
10 changes: 10 additions & 0 deletions additional.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
import 'styled-components';
import type {theme} from '@/src/style';

declare module '*.module.css';

type CustomTheme = typeof theme;

declare module 'styled-components' {
/* eslint-disable-next-line @typescript-eslint/consistent-type-definitions */
export interface DefaultTheme extends CustomTheme {}
}
8 changes: 0 additions & 8 deletions app/index.css

This file was deleted.

12 changes: 8 additions & 4 deletions app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type {ReactNode} from 'react';

import {StoreProvider} from '@/src/state/StoreProvider';
import './index.css';
import {StyledComponentsRegistry, ThemeProvider} from '@/src/style';

type Props = {
readonly children: ReactNode;
Expand All @@ -10,9 +10,13 @@ type Props = {
export default function RootLayout({children}: Props) {
return (
<StoreProvider>
<html lang="en" suppressHydrationWarning>
<body>{children}</body>
</html>
<ThemeProvider>
<html lang="en" suppressHydrationWarning>
<body>
<StyledComponentsRegistry>{children}</StyledComponentsRegistry>
</body>
</html>
</ThemeProvider>
</StoreProvider>
);
}
5 changes: 4 additions & 1 deletion next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ module.exports = withBundleAnalyzer({
reactStrictMode: true,
swcMinify: true,
distDir: 'build',
output: process.env.PAGES_BUILD === 'true' ? 'export' : undefined,
cleanDistDir: true,
output: process.env.PAGES_BUILD === 'true' ? 'export' : undefined,
basePath: process.env.PAGES_BUILD === 'true' ? '/ts-redux-next' : undefined,
compiler: {
styledComponents: true,
},
});
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"start": "next start",
"lint:code": "eslint src/ --ext .js,.jsx,.ts,.tsx",
"fix:code": "run-s 'lint:code --fix'",
"lint:style": "stylelint 'src/**/*.css'",
"fix:style": "stylelint 'src/**/*.css' --fix",
"lint:style": "stylelint 'src/**/*.{ts,tsx}'",
"fix:style": "stylelint 'src/**/*.{ts,tsx}' --fix",
"lint:tsc": "tsc --pretty --noEmit",
"prepare": "is-ci || husky install",
"test": "jest",
Expand All @@ -27,6 +27,7 @@
"react-dom": "18.3.1",
"react-redux": "9.1.2",
"redux": "5.0.1",
"styled-components": "^6.1.11",
"uniqid": "5.4.0"
},
"devDependencies": {
Expand Down Expand Up @@ -59,13 +60,12 @@
"npm-run-all2": "6.1.2",
"postcss": "8.4.38",
"postcss-preset-env": "9.5.13",
"postcss-styled-syntax": "0.6.4",
"prettier": "3.2.5",
"redux-mock-store": "1.5.4",
"stylelint": "16.5.0",
"stylelint-config-prettier": "9.0.5",
"stylelint-config-standard": "36.0.0",
"stylelint-order": "6.0.4",
"stylelint-prettier": "5.0.0",
"typescript": "5.4.5"
}
}
Loading

0 comments on commit 63422c3

Please sign in to comment.