mirror of
https://github.com/mantinedev/next-app-template.git
synced 2025-11-13 16:22:33 +10:00
Compare commits
1 Commits
c6079c7741
...
sass-embed
| Author | SHA1 | Date | |
|---|---|---|---|
| 8d8c25b729 |
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',
|
||||||
|
},
|
||||||
|
};
|
||||||
@ -7,7 +7,7 @@ const config: StorybookConfig = {
|
|||||||
enableCrashReports: false,
|
enableCrashReports: false,
|
||||||
},
|
},
|
||||||
stories: ['../components/**/*.(stories|story).@(js|jsx|ts|tsx)'],
|
stories: ['../components/**/*.(stories|story).@(js|jsx|ts|tsx)'],
|
||||||
addons: ['@storybook/addon-themes'],
|
addons: ['storybook-dark-mode'],
|
||||||
framework: {
|
framework: {
|
||||||
name: '@storybook/nextjs',
|
name: '@storybook/nextjs',
|
||||||
options: {},
|
options: {},
|
||||||
|
|||||||
@ -1,40 +1,33 @@
|
|||||||
import '@mantine/core/styles.css';
|
import '@mantine/core/styles.css';
|
||||||
|
|
||||||
import { ColorSchemeScript, MantineProvider } from '@mantine/core';
|
import React, { useEffect } from 'react';
|
||||||
|
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 = {
|
export const parameters = {
|
||||||
layout: 'fullscreen',
|
layout: 'fullscreen',
|
||||||
options: {
|
options: {
|
||||||
showPanel: false,
|
showPanel: false,
|
||||||
storySort: (a: any, b: any) => a.title.localeCompare(b.title, undefined, { numeric: true }),
|
|
||||||
},
|
},
|
||||||
backgrounds: { disable: true },
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const globalTypes = {
|
const channel = addons.getChannel();
|
||||||
theme: {
|
|
||||||
name: 'Theme',
|
function ColorSchemeWrapper({ children }: { children: React.ReactNode }) {
|
||||||
description: 'Mantine color scheme',
|
const { setColorScheme } = useMantineColorScheme();
|
||||||
defaultValue: 'light',
|
const handleColorScheme = (value: boolean) => setColorScheme(value ? 'dark' : 'light');
|
||||||
toolbar: {
|
|
||||||
icon: 'mirror',
|
useEffect(() => {
|
||||||
items: [
|
channel.on(DARK_MODE_EVENT_NAME, handleColorScheme);
|
||||||
{ value: 'light', title: 'Light' },
|
return () => channel.off(DARK_MODE_EVENT_NAME, handleColorScheme);
|
||||||
{ value: 'dark', title: 'Dark' },
|
}, [channel]);
|
||||||
],
|
|
||||||
},
|
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>
|
|
||||||
);
|
|
||||||
},
|
|
||||||
];
|
];
|
||||||
|
|||||||
942
.yarn/releases/yarn-4.10.3.cjs
vendored
942
.yarn/releases/yarn-4.10.3.cjs
vendored
File diff suppressed because one or more lines are too long
934
.yarn/releases/yarn-4.5.1.cjs
vendored
Executable file
934
.yarn/releases/yarn-4.5.1.cjs
vendored
Executable file
File diff suppressed because one or more lines are too long
@ -1,3 +1,3 @@
|
|||||||
nodeLinker: node-modules
|
nodeLinker: node-modules
|
||||||
|
|
||||||
yarnPath: .yarn/releases/yarn-4.10.3.cjs
|
yarnPath: .yarn/releases/yarn-4.5.1.cjs
|
||||||
|
|||||||
64
_mantine.scss
Normal file
64
_mantine.scss
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
@use 'sass:math';
|
||||||
|
|
||||||
|
// Define variables for your breakpoints,
|
||||||
|
// values must be the same as in your theme
|
||||||
|
$mantine-breakpoint-xs: '36em';
|
||||||
|
$mantine-breakpoint-sm: '48em';
|
||||||
|
$mantine-breakpoint-md: '62em';
|
||||||
|
$mantine-breakpoint-lg: '75em';
|
||||||
|
$mantine-breakpoint-xl: '88em';
|
||||||
|
|
||||||
|
@function rem($value) {
|
||||||
|
@return #{math.div(math.div($value, $value * 0 + 1), 16)}rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
@mixin light {
|
||||||
|
[data-mantine-color-scheme='light'] & {
|
||||||
|
@content;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@mixin dark {
|
||||||
|
[data-mantine-color-scheme='dark'] & {
|
||||||
|
@content;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@mixin hover {
|
||||||
|
@media (hover: hover) {
|
||||||
|
&:hover {
|
||||||
|
@content;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (hover: none) {
|
||||||
|
&:active {
|
||||||
|
@content;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@mixin smaller-than($breakpoint) {
|
||||||
|
@media (max-width: $breakpoint) {
|
||||||
|
@content;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@mixin larger-than($breakpoint) {
|
||||||
|
@media (min-width: $breakpoint) {
|
||||||
|
@content;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add direction mixins if you need rtl support
|
||||||
|
@mixin rtl {
|
||||||
|
[dir='rtl'] & {
|
||||||
|
@content;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@mixin ltr {
|
||||||
|
[dir='ltr'] & {
|
||||||
|
@content;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,7 +1,7 @@
|
|||||||
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 { ColorSchemeScript, MantineProvider } from '@mantine/core';
|
||||||
import { theme } from '../theme';
|
import { theme } from '../theme';
|
||||||
|
|
||||||
export const metadata = {
|
export const metadata = {
|
||||||
@ -11,7 +11,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" suppressHydrationWarning>
|
||||||
<head>
|
<head>
|
||||||
<ColorSchemeScript />
|
<ColorSchemeScript />
|
||||||
<link rel="shortcut icon" href="/favicon.svg" />
|
<link rel="shortcut icon" href="/favicon.svg" />
|
||||||
|
|||||||
@ -1,10 +0,0 @@
|
|||||||
.title {
|
|
||||||
color: light-dark(var(--mantine-color-black), var(--mantine-color-white));
|
|
||||||
font-size: rem(100px);
|
|
||||||
font-weight: 900;
|
|
||||||
letter-spacing: rem(-2px);
|
|
||||||
|
|
||||||
@media (max-width: $mantine-breakpoint-md) {
|
|
||||||
font-size: rem(50px);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
10
components/Welcome/Welcome.module.scss
Normal file
10
components/Welcome/Welcome.module.scss
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
.title {
|
||||||
|
color: light-dark(var(--mantine-color-black), var(--mantine-color-white));
|
||||||
|
font-size: mantine.rem(100px);
|
||||||
|
font-weight: 900;
|
||||||
|
letter-spacing: mantine.rem(-2px);
|
||||||
|
|
||||||
|
@media (max-width: mantine.$mantine-breakpoint-md) {
|
||||||
|
font-size: mantine.rem(50px);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,5 +1,5 @@
|
|||||||
|
import classes from './Welcome.module.scss';
|
||||||
import { Anchor, Text, Title } from '@mantine/core';
|
import { Anchor, Text, Title } from '@mantine/core';
|
||||||
import classes from './Welcome.module.css';
|
|
||||||
|
|
||||||
export function Welcome() {
|
export function Welcome() {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -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'],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
);
|
|
||||||
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/app/building-your-application/configuring/typescript for more information.
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
import path from 'path';
|
||||||
import bundleAnalyzer from '@next/bundle-analyzer';
|
import bundleAnalyzer from '@next/bundle-analyzer';
|
||||||
|
|
||||||
const withBundleAnalyzer = bundleAnalyzer({
|
const withBundleAnalyzer = bundleAnalyzer({
|
||||||
@ -12,4 +13,9 @@ export default withBundleAnalyzer({
|
|||||||
experimental: {
|
experimental: {
|
||||||
optimizePackageImports: ['@mantine/core', '@mantine/hooks'],
|
optimizePackageImports: ['@mantine/core', '@mantine/hooks'],
|
||||||
},
|
},
|
||||||
|
|
||||||
|
sassOptions: {
|
||||||
|
implementation: 'sass-embedded',
|
||||||
|
additionalData: `@use "${path.join(process.cwd(), '_mantine')}" as mantine;`,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
90
package.json
90
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,53 @@
|
|||||||
"storybook:build": "storybook build"
|
"storybook:build": "storybook build"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@mantine/core": "8.3.2",
|
"@mantine/core": "7.13.4",
|
||||||
"@mantine/hooks": "8.3.2",
|
"@mantine/hooks": "7.13.4",
|
||||||
"@next/bundle-analyzer": "^15.5.3",
|
"@next/bundle-analyzer": "^14.2.4",
|
||||||
"@tabler/icons-react": "^3.34.1",
|
"@tabler/icons-react": "^3.6.0",
|
||||||
"next": "15.5.3",
|
"next": "15.0.1",
|
||||||
"react": "19.1.1",
|
"react": "18.3.1",
|
||||||
"react-dom": "19.1.1"
|
"react-dom": "18.3.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.28.4",
|
"@babel/core": "^7.24.7",
|
||||||
"@eslint/eslintrc": "^3",
|
"@ianvs/prettier-plugin-sort-imports": "^4.3.1",
|
||||||
"@eslint/js": "^9.35.0",
|
"@next/eslint-plugin-next": "^14.2.4",
|
||||||
"@ianvs/prettier-plugin-sort-imports": "^4.7.0",
|
"@storybook/nextjs": "^8.1.10",
|
||||||
"@storybook/addon-themes": "^9.1.5",
|
"@storybook/react": "^8.1.10",
|
||||||
"@storybook/nextjs": "^9.1.5",
|
"@testing-library/dom": "^10.1.0",
|
||||||
"@storybook/react": "^9.1.5",
|
"@testing-library/jest-dom": "^6.4.6",
|
||||||
"@testing-library/dom": "^10.4.1",
|
"@testing-library/react": "^16.0.0",
|
||||||
"@testing-library/jest-dom": "^6.8.0",
|
"@testing-library/user-event": "^14.5.2",
|
||||||
"@testing-library/react": "^16.3.0",
|
"@types/jest": "^29.5.12",
|
||||||
"@testing-library/user-event": "^14.6.1",
|
"@types/node": "^20.14.8",
|
||||||
"@types/eslint-plugin-jsx-a11y": "^6",
|
"@types/react": "18.3.3",
|
||||||
"@types/jest": "^30.0.0",
|
"@typescript-eslint/eslint-plugin": "^7.13.1",
|
||||||
"@types/node": "^24.3.1",
|
"@typescript-eslint/parser": "^7.13.1",
|
||||||
"@types/react": "19.1.12",
|
"babel-loader": "^9.1.3",
|
||||||
"babel-loader": "^10.0.0",
|
"eslint": "^8.57.0",
|
||||||
"eslint": "^9.35.0",
|
"eslint-config-airbnb": "19.0.4",
|
||||||
"eslint-config-mantine": "^4.0.3",
|
"eslint-config-airbnb-typescript": "^18.0.0",
|
||||||
"eslint-config-next": "15.5.3",
|
"eslint-config-mantine": "3.2.0",
|
||||||
"eslint-plugin-jsx-a11y": "^6.10.2",
|
"eslint-plugin-import": "^2.29.1",
|
||||||
"eslint-plugin-react": "^7.37.5",
|
"eslint-plugin-jest": "^28.6.0",
|
||||||
"jest": "^30.1.3",
|
"eslint-plugin-jsx-a11y": "^6.9.0",
|
||||||
"jest-environment-jsdom": "^30.1.2",
|
"eslint-plugin-react": "^7.34.3",
|
||||||
"postcss": "^8.5.6",
|
"eslint-plugin-react-hooks": "^4.6.2",
|
||||||
"postcss-preset-mantine": "1.18.0",
|
"eslint-plugin-testing-library": "^6.2.2",
|
||||||
|
"jest": "^29.7.0",
|
||||||
|
"jest-environment-jsdom": "^29.7.0",
|
||||||
|
"postcss": "^8.4.38",
|
||||||
|
"postcss-preset-mantine": "1.17.0",
|
||||||
"postcss-simple-vars": "^7.0.1",
|
"postcss-simple-vars": "^7.0.1",
|
||||||
"prettier": "^3.6.2",
|
"prettier": "^3.3.2",
|
||||||
"storybook": "^9.1.5",
|
"sass-embedded": "^1.80.6",
|
||||||
"stylelint": "^16.24.0",
|
"storybook": "^8.1.10",
|
||||||
"stylelint-config-standard-scss": "^16.0.0",
|
"storybook-dark-mode": "^4.0.2",
|
||||||
"ts-jest": "^29.4.1",
|
"stylelint": "^16.6.1",
|
||||||
"typescript": "5.9.2",
|
"stylelint-config-standard-scss": "^13.1.0",
|
||||||
"typescript-eslint": "^8.43.0"
|
"ts-jest": "^29.1.5",
|
||||||
|
"typescript": "5.5.2"
|
||||||
},
|
},
|
||||||
"packageManager": "yarn@4.10.3"
|
"packageManager": "yarn@4.5.1"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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": {
|
||||||
"@/*": ["./*"]
|
"@/*": ["./*"]
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"include": [
|
"plugins": [{ "name": "next" }]
|
||||||
"next-env.d.ts",
|
},
|
||||||
"**/*.ts",
|
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
|
||||||
"**/*.tsx",
|
|
||||||
".storybook/main.ts",
|
|
||||||
".storybook/preview.tsx"
|
|
||||||
],
|
|
||||||
"exclude": ["node_modules"]
|
"exclude": ["node_modules"]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user