mirror of
https://github.com/mantinedev/next-app-template.git
synced 2025-11-13 00:02:32 +10:00
Compare commits
1 Commits
8926c997b9
...
mantine-te
| Author | SHA1 | Date | |
|---|---|---|---|
| 8e798f84d1 |
3
.eslintignore
Normal file
3
.eslintignore
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
*.cjs
|
||||||
|
*.mjs
|
||||||
|
*.js
|
||||||
17
.eslintrc.cjs
Normal file
17
.eslintrc.cjs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
module.exports = {
|
||||||
|
extends: ['mantine', 'plugin:@next/next/recommended', 'plugin:jest/recommended'],
|
||||||
|
plugins: ['testing-library', 'jest'],
|
||||||
|
overrides: [
|
||||||
|
{
|
||||||
|
files: ['**/?(*.)+(spec|test).[jt]s?(x)'],
|
||||||
|
extends: ['plugin:testing-library/react'],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
parserOptions: {
|
||||||
|
project: './tsconfig.json',
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
'react/react-in-jsx-scope': 'off',
|
||||||
|
'import/extensions': 'off',
|
||||||
|
},
|
||||||
|
};
|
||||||
27
.github/workflows/npm_test.yml
vendored
27
.github/workflows/npm_test.yml
vendored
@ -1,27 +0,0 @@
|
|||||||
name: npm test
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
branches:
|
|
||||||
- '**'
|
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: ${{ github.workflow }}-${{ github.event.number || github.sha }}
|
|
||||||
cancel-in-progress: true
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
test_pull_request:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
- uses: actions/setup-node@v3
|
|
||||||
with:
|
|
||||||
node-version-file: '.nvmrc'
|
|
||||||
cache: 'yarn'
|
|
||||||
cache-dependency-path: '**/yarn.lock'
|
|
||||||
- name: Install dependencies
|
|
||||||
run: yarn
|
|
||||||
- name: Run build
|
|
||||||
run: npm run build
|
|
||||||
- name: Run tests
|
|
||||||
run: npm test
|
|
||||||
1
.prettierrc.cjs
Normal file
1
.prettierrc.cjs
Normal file
@ -0,0 +1 @@
|
|||||||
|
module.exports = require('eslint-config-mantine/.prettierrc.js');
|
||||||
@ -1,35 +0,0 @@
|
|||||||
/** @type {import("@ianvs/prettier-plugin-sort-imports").PrettierConfig} */
|
|
||||||
const config = {
|
|
||||||
printWidth: 100,
|
|
||||||
singleQuote: true,
|
|
||||||
trailingComma: 'es5',
|
|
||||||
plugins: ['@ianvs/prettier-plugin-sort-imports'],
|
|
||||||
importOrder: [
|
|
||||||
'.*styles.css$',
|
|
||||||
'',
|
|
||||||
'dayjs',
|
|
||||||
'^react$',
|
|
||||||
'^next$',
|
|
||||||
'^next/.*$',
|
|
||||||
'<BUILTIN_MODULES>',
|
|
||||||
'<THIRD_PARTY_MODULES>',
|
|
||||||
'^@mantine/(.*)$',
|
|
||||||
'^@mantinex/(.*)$',
|
|
||||||
'^@mantine-tests/(.*)$',
|
|
||||||
'^@docs/(.*)$',
|
|
||||||
'^@/.*$',
|
|
||||||
'^../(?!.*.css$).*$',
|
|
||||||
'^./(?!.*.css$).*$',
|
|
||||||
'\\.css$',
|
|
||||||
],
|
|
||||||
overrides: [
|
|
||||||
{
|
|
||||||
files: '*.mdx',
|
|
||||||
options: {
|
|
||||||
printWidth: 70,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
|
||||||
|
|
||||||
export default config;
|
|
||||||
@ -1,16 +1,16 @@
|
|||||||
import type { StorybookConfig } from '@storybook/nextjs';
|
import type { StorybookConfig } from '@storybook/nextjs';
|
||||||
|
|
||||||
const config: StorybookConfig = {
|
const config: StorybookConfig = {
|
||||||
core: {
|
|
||||||
disableWhatsNewNotifications: true,
|
|
||||||
disableTelemetry: true,
|
|
||||||
enableCrashReports: false,
|
|
||||||
},
|
|
||||||
stories: ['../components/**/*.(stories|story).@(js|jsx|ts|tsx)'],
|
stories: ['../components/**/*.(stories|story).@(js|jsx|ts|tsx)'],
|
||||||
addons: ['@storybook/addon-themes'],
|
addons: [
|
||||||
|
'@storybook/addon-essentials',
|
||||||
|
'storybook-dark-mode',
|
||||||
|
'@storybook/addon-styling-webpack',
|
||||||
|
],
|
||||||
framework: {
|
framework: {
|
||||||
name: '@storybook/nextjs',
|
name: '@storybook/nextjs',
|
||||||
options: {},
|
options: {},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export default config;
|
export default config;
|
||||||
|
|||||||
@ -1,40 +1,25 @@
|
|||||||
import '@mantine/core/styles.css';
|
import '@mantine/core/styles.css';
|
||||||
|
import React, { useEffect } from 'react';
|
||||||
import { ColorSchemeScript, MantineProvider } from '@mantine/core';
|
import { addons } from '@storybook/preview-api';
|
||||||
|
import { DARK_MODE_EVENT_NAME } from 'storybook-dark-mode';
|
||||||
|
import { MantineProvider, useMantineColorScheme } from '@mantine/core';
|
||||||
import { theme } from '../theme';
|
import { theme } from '../theme';
|
||||||
|
|
||||||
export const parameters = {
|
const channel = addons.getChannel();
|
||||||
layout: 'fullscreen',
|
|
||||||
options: {
|
|
||||||
showPanel: false,
|
|
||||||
storySort: (a: any, b: any) => a.title.localeCompare(b.title, undefined, { numeric: true }),
|
|
||||||
},
|
|
||||||
backgrounds: { disable: true },
|
|
||||||
};
|
|
||||||
|
|
||||||
export const globalTypes = {
|
function ColorSchemeWrapper({ children }: { children: React.ReactNode }) {
|
||||||
theme: {
|
const { setColorScheme } = useMantineColorScheme();
|
||||||
name: 'Theme',
|
const handleColorScheme = (value: boolean) => setColorScheme(value ? 'dark' : 'light');
|
||||||
description: 'Mantine color scheme',
|
|
||||||
defaultValue: 'light',
|
useEffect(() => {
|
||||||
toolbar: {
|
channel.on(DARK_MODE_EVENT_NAME, handleColorScheme);
|
||||||
icon: 'mirror',
|
return () => channel.off(DARK_MODE_EVENT_NAME, handleColorScheme);
|
||||||
items: [
|
}, [channel]);
|
||||||
{ value: 'light', title: 'Light' },
|
|
||||||
{ value: 'dark', title: 'Dark' },
|
return <>{children}</>;
|
||||||
],
|
}
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
export const decorators = [
|
export const decorators = [
|
||||||
(renderStory: any, context: any) => {
|
(renderStory: any) => <ColorSchemeWrapper>{renderStory()}</ColorSchemeWrapper>,
|
||||||
const scheme = (context.globals.theme || 'light') as 'light' | 'dark';
|
(renderStory: any) => <MantineProvider theme={theme}>{renderStory()}</MantineProvider>,
|
||||||
return (
|
|
||||||
<MantineProvider theme={theme} forceColorScheme={scheme}>
|
|
||||||
<ColorSchemeScript />
|
|
||||||
{renderStory()}
|
|
||||||
</MantineProvider>
|
|
||||||
);
|
|
||||||
},
|
|
||||||
];
|
];
|
||||||
|
|||||||
893
.yarn/releases/yarn-4.0.1.cjs
vendored
Executable file
893
.yarn/releases/yarn-4.0.1.cjs
vendored
Executable file
File diff suppressed because one or more lines are too long
942
.yarn/releases/yarn-4.10.2.cjs
vendored
942
.yarn/releases/yarn-4.10.2.cjs
vendored
File diff suppressed because one or more lines are too long
@ -1,3 +1,2 @@
|
|||||||
nodeLinker: node-modules
|
nodeLinker: node-modules
|
||||||
|
yarnPath: .yarn/releases/yarn-4.0.1.cjs
|
||||||
yarnPath: .yarn/releases/yarn-4.10.2.cjs
|
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
import '@mantine/core/styles.css';
|
import '@mantine/core/styles.css';
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { ColorSchemeScript, mantineHtmlProps, MantineProvider } from '@mantine/core';
|
import { MantineProvider, ColorSchemeScript } from '@mantine/core';
|
||||||
import { theme } from '../theme';
|
import { theme } from '../theme';
|
||||||
|
|
||||||
export const metadata = {
|
export const metadata = {
|
||||||
@ -11,7 +10,7 @@ export const metadata = {
|
|||||||
|
|
||||||
export default function RootLayout({ children }: { children: any }) {
|
export default function RootLayout({ children }: { children: any }) {
|
||||||
return (
|
return (
|
||||||
<html lang="en" {...mantineHtmlProps}>
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<ColorSchemeScript />
|
<ColorSchemeScript />
|
||||||
<link rel="shortcut icon" href="/favicon.svg" />
|
<link rel="shortcut icon" href="/favicon.svg" />
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { ColorSchemeToggle } from '../components/ColorSchemeToggle/ColorSchemeToggle';
|
|
||||||
import { Welcome } from '../components/Welcome/Welcome';
|
import { Welcome } from '../components/Welcome/Welcome';
|
||||||
|
import { ColorSchemeToggle } from '../components/ColorSchemeToggle/ColorSchemeToggle';
|
||||||
|
|
||||||
export default function HomePage() {
|
export default function HomePage() {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -1,7 +1,9 @@
|
|||||||
import { render, screen } from '@/test-utils';
|
import { render, screen, tests } from '@/test-utils';
|
||||||
import { Welcome } from './Welcome';
|
import { Welcome } from './Welcome';
|
||||||
|
|
||||||
describe('Welcome component', () => {
|
describe('Welcome component', () => {
|
||||||
|
tests.itSupportsClassName({ component: Welcome, props: {} });
|
||||||
|
|
||||||
it('has correct Next.js theming section link', () => {
|
it('has correct Next.js theming section link', () => {
|
||||||
render(<Welcome />);
|
render(<Welcome />);
|
||||||
expect(screen.getByText('this guide')).toHaveAttribute(
|
expect(screen.getByText('this guide')).toHaveAttribute(
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
import { Anchor, Text, Title } from '@mantine/core';
|
import { Title, Text, Anchor } from '@mantine/core';
|
||||||
import classes from './Welcome.module.css';
|
import classes from './Welcome.module.css';
|
||||||
|
|
||||||
export function Welcome() {
|
export function Welcome(props: React.ComponentPropsWithoutRef<'div'>) {
|
||||||
return (
|
return (
|
||||||
<>
|
<div {...props}>
|
||||||
<Title className={classes.title} ta="center" mt={100}>
|
<Title className={classes.title} ta="center" mt={100}>
|
||||||
Welcome to{' '}
|
Welcome to{' '}
|
||||||
<Text inherit variant="gradient" component="span" gradient={{ from: 'pink', to: 'yellow' }}>
|
<Text inherit variant="gradient" component="span" gradient={{ from: 'pink', to: 'yellow' }}>
|
||||||
@ -18,6 +18,6 @@ export function Welcome() {
|
|||||||
</Anchor>
|
</Anchor>
|
||||||
. To get started edit page.tsx file.
|
. To get started edit page.tsx file.
|
||||||
</Text>
|
</Text>
|
||||||
</>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,22 +0,0 @@
|
|||||||
import mantine from 'eslint-config-mantine';
|
|
||||||
import { defineConfig } from 'eslint/config';
|
|
||||||
import tseslint from 'typescript-eslint';
|
|
||||||
|
|
||||||
// @ts-check
|
|
||||||
export default defineConfig(
|
|
||||||
tseslint.configs.recommended,
|
|
||||||
...mantine,
|
|
||||||
{ ignores: ['**/*.{mjs,cjs,js,d.ts,d.mts}', '.next'] },
|
|
||||||
{
|
|
||||||
files: ['**/*.story.tsx'],
|
|
||||||
rules: { 'no-console': 'off' },
|
|
||||||
},
|
|
||||||
{
|
|
||||||
languageOptions: {
|
|
||||||
parserOptions: {
|
|
||||||
tsconfigRootDir: process.cwd(),
|
|
||||||
project: ['./tsconfig.json'],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
);
|
|
||||||
@ -2,7 +2,6 @@ require('@testing-library/jest-dom');
|
|||||||
|
|
||||||
const { getComputedStyle } = window;
|
const { getComputedStyle } = window;
|
||||||
window.getComputedStyle = (elt) => getComputedStyle(elt);
|
window.getComputedStyle = (elt) => getComputedStyle(elt);
|
||||||
window.HTMLElement.prototype.scrollIntoView = () => {};
|
|
||||||
|
|
||||||
Object.defineProperty(window, 'matchMedia', {
|
Object.defineProperty(window, 'matchMedia', {
|
||||||
writable: true,
|
writable: true,
|
||||||
|
|||||||
3
next-env.d.ts
vendored
3
next-env.d.ts
vendored
@ -1,6 +1,5 @@
|
|||||||
/// <reference types="next" />
|
/// <reference types="next" />
|
||||||
/// <reference types="next/image-types/global" />
|
/// <reference types="next/image-types/global" />
|
||||||
/// <reference path="./.next/types/routes.d.ts" />
|
|
||||||
|
|
||||||
// NOTE: This file should not be edited
|
// NOTE: This file should not be edited
|
||||||
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
|
// see https://nextjs.org/docs/basic-features/typescript for more information.
|
||||||
|
|||||||
93
package.json
93
package.json
@ -8,9 +8,8 @@
|
|||||||
"analyze": "ANALYZE=true next build",
|
"analyze": "ANALYZE=true next build",
|
||||||
"start": "next start",
|
"start": "next start",
|
||||||
"typecheck": "tsc --noEmit",
|
"typecheck": "tsc --noEmit",
|
||||||
"lint": "npm run eslint && npm run stylelint",
|
"lint": "next lint && npm run lint:stylelint",
|
||||||
"eslint": "eslint .",
|
"lint:stylelint": "stylelint '**/*.css' --cache",
|
||||||
"stylelint": "stylelint '**/*.css' --cache",
|
|
||||||
"jest": "jest",
|
"jest": "jest",
|
||||||
"jest:watch": "jest --watch",
|
"jest:watch": "jest --watch",
|
||||||
"prettier:check": "prettier --check \"**/*.{ts,tsx}\"",
|
"prettier:check": "prettier --check \"**/*.{ts,tsx}\"",
|
||||||
@ -20,48 +19,56 @@
|
|||||||
"storybook:build": "storybook build"
|
"storybook:build": "storybook build"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@mantine/core": "8.3.1",
|
"@mantine/core": "7.2.2",
|
||||||
"@mantine/hooks": "8.3.1",
|
"@mantine/hooks": "7.2.2",
|
||||||
"@next/bundle-analyzer": "^15.5.3",
|
"@next/bundle-analyzer": "^14.0.1",
|
||||||
"@tabler/icons-react": "^3.34.1",
|
"@tabler/icons-react": "^2.40.0",
|
||||||
"next": "15.5.3",
|
"next": "14.0.1",
|
||||||
"react": "19.1.1",
|
"react": "18.2.0",
|
||||||
"react-dom": "19.1.1"
|
"react-dom": "18.2.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.28.4",
|
"@babel/core": "^7.23.2",
|
||||||
"@eslint/eslintrc": "^3",
|
"@mantine-tests/core": "^1.0.1",
|
||||||
"@eslint/js": "^9.35.0",
|
"@next/eslint-plugin-next": "^14.0.1",
|
||||||
"@ianvs/prettier-plugin-sort-imports": "^4.7.0",
|
"@storybook/addon-essentials": "^7.5.2",
|
||||||
"@storybook/addon-themes": "^9.1.5",
|
"@storybook/addon-styling-webpack": "^0.0.5",
|
||||||
"@storybook/nextjs": "^9.1.5",
|
"@storybook/blocks": "^7.5.2",
|
||||||
"@storybook/react": "^9.1.5",
|
"@storybook/nextjs": "^7.5.2",
|
||||||
"@testing-library/dom": "^10.4.1",
|
"@storybook/react": "^7.5.2",
|
||||||
"@testing-library/jest-dom": "^6.8.0",
|
"@testing-library/dom": "^9.3.3",
|
||||||
"@testing-library/react": "^16.3.0",
|
"@testing-library/jest-dom": "^6.1.4",
|
||||||
"@testing-library/user-event": "^14.6.1",
|
"@testing-library/react": "^14.0.0",
|
||||||
"@types/eslint-plugin-jsx-a11y": "^6",
|
"@testing-library/user-event": "^14.5.1",
|
||||||
"@types/jest": "^30.0.0",
|
"@types/jest": "^29.5.7",
|
||||||
"@types/node": "^24.3.1",
|
"@types/node": "^20.8.10",
|
||||||
"@types/react": "19.1.12",
|
"@types/react": "18.2.34",
|
||||||
"babel-loader": "^10.0.0",
|
"@typescript-eslint/eslint-plugin": "^6.9.1",
|
||||||
"eslint": "^9.35.0",
|
"@typescript-eslint/parser": "^6.9.1",
|
||||||
"eslint-config-mantine": "^4.0.3",
|
"babel-loader": "^9.1.3",
|
||||||
"eslint-config-next": "15.5.3",
|
"eslint": "^8.53.0",
|
||||||
"eslint-plugin-jsx-a11y": "^6.10.2",
|
"eslint-config-airbnb": "19.0.4",
|
||||||
"eslint-plugin-react": "^7.37.5",
|
"eslint-config-airbnb-typescript": "^17.1.0",
|
||||||
"jest": "^30.1.3",
|
"eslint-config-mantine": "3.0.0",
|
||||||
"jest-environment-jsdom": "^30.1.2",
|
"eslint-plugin-import": "^2.29.0",
|
||||||
"postcss": "^8.5.6",
|
"eslint-plugin-jest": "^27.6.0",
|
||||||
"postcss-preset-mantine": "1.18.0",
|
"eslint-plugin-jsx-a11y": "^6.8.0",
|
||||||
|
"eslint-plugin-react": "^7.33.2",
|
||||||
|
"eslint-plugin-react-hooks": "^4.6.0",
|
||||||
|
"eslint-plugin-testing-library": "^6.1.0",
|
||||||
|
"jest": "^29.7.0",
|
||||||
|
"jest-axe": "^8.0.0",
|
||||||
|
"jest-environment-jsdom": "^29.7.0",
|
||||||
|
"postcss": "^8.4.31",
|
||||||
|
"postcss-preset-mantine": "1.11.0",
|
||||||
"postcss-simple-vars": "^7.0.1",
|
"postcss-simple-vars": "^7.0.1",
|
||||||
"prettier": "^3.6.2",
|
"prettier": "^3.0.3",
|
||||||
"storybook": "^9.1.5",
|
"storybook": "^7.5.2",
|
||||||
"stylelint": "^16.24.0",
|
"storybook-dark-mode": "^3.0.1",
|
||||||
"stylelint-config-standard-scss": "^16.0.0",
|
"stylelint": "^15.11.0",
|
||||||
"ts-jest": "^29.4.1",
|
"stylelint-config-standard-scss": "^11.1.0",
|
||||||
"typescript": "5.9.2",
|
"ts-jest": "^29.1.1",
|
||||||
"typescript-eslint": "^8.43.0"
|
"typescript": "5.2.2"
|
||||||
},
|
},
|
||||||
"packageManager": "yarn@4.10.2"
|
"packageManager": "yarn@4.0.1"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
import userEvent from '@testing-library/user-event';
|
import userEvent from '@testing-library/user-event';
|
||||||
|
|
||||||
|
export { tests } from '@mantine-tests/core';
|
||||||
export * from '@testing-library/react';
|
export * from '@testing-library/react';
|
||||||
export { render } from './render';
|
export { render } from './render';
|
||||||
export { userEvent };
|
export { userEvent };
|
||||||
|
|||||||
@ -5,9 +5,7 @@ import { theme } from '../theme';
|
|||||||
export function render(ui: React.ReactNode) {
|
export function render(ui: React.ReactNode) {
|
||||||
return testingLibraryRender(<>{ui}</>, {
|
return testingLibraryRender(<>{ui}</>, {
|
||||||
wrapper: ({ children }: { children: React.ReactNode }) => (
|
wrapper: ({ children }: { children: React.ReactNode }) => (
|
||||||
<MantineProvider theme={theme} env="test">
|
<MantineProvider theme={theme}>{children}</MantineProvider>
|
||||||
{children}
|
|
||||||
</MantineProvider>
|
|
||||||
),
|
),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -17,14 +17,9 @@
|
|||||||
"incremental": true,
|
"incremental": true,
|
||||||
"paths": {
|
"paths": {
|
||||||
"@/*": ["./*"]
|
"@/*": ["./*"]
|
||||||
}
|
},
|
||||||
|
"plugins": [{ "name": "next" }]
|
||||||
},
|
},
|
||||||
"include": [
|
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
|
||||||
"next-env.d.ts",
|
|
||||||
"**/*.ts",
|
|
||||||
"**/*.tsx",
|
|
||||||
".storybook/main.ts",
|
|
||||||
".storybook/preview.tsx"
|
|
||||||
],
|
|
||||||
"exclude": ["node_modules"]
|
"exclude": ["node_modules"]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user