-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🧶 chore: install next.js and mantine and tailwind css with yarn #1
- Loading branch information
1 parent
99e966b
commit 56e20d0
Showing
36 changed files
with
17,612 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
*.cjs | ||
*.mjs | ||
*.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
lerna-debug.log* | ||
.pnpm-debug.log* | ||
|
||
# Diagnostic reports (https://nodejs.org/api/report.html) | ||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
*.lcov | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
|
||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# Bower dependency directory (https://bower.io/) | ||
bower_components | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (https://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories | ||
node_modules/ | ||
jspm_packages/ | ||
|
||
# Snowpack dependency directory (https://snowpack.dev/) | ||
web_modules/ | ||
|
||
# TypeScript cache | ||
*.tsbuildinfo | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional eslint cache | ||
.eslintcache | ||
|
||
# Optional stylelint cache | ||
.stylelintcache | ||
|
||
# Microbundle cache | ||
.rpt2_cache/ | ||
.rts2_cache_cjs/ | ||
.rts2_cache_es/ | ||
.rts2_cache_umd/ | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# Output of 'npm pack' | ||
*.tgz | ||
|
||
# Yarn Integrity file | ||
.yarn-integrity | ||
|
||
# dotenv environment variable files | ||
.env | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
.env.local | ||
|
||
# parcel-bundler cache (https://parceljs.org/) | ||
.cache | ||
.parcel-cache | ||
|
||
# Next.js build output | ||
.next | ||
out | ||
|
||
# Nuxt.js build / generate output | ||
.nuxt | ||
dist | ||
|
||
# Gatsby files | ||
.cache/ | ||
# Comment in the public line in if your project uses Gatsby and not Next.js | ||
# https://nextjs.org/blog/next-9-1#public-directory-support | ||
# public | ||
|
||
# vuepress build output | ||
.vuepress/dist | ||
|
||
# vuepress v2.x temp and cache directory | ||
.temp | ||
.cache | ||
|
||
# Docusaurus cache and generated files | ||
.docusaurus | ||
|
||
# Serverless directories | ||
.serverless/ | ||
|
||
# FuseBox cache | ||
.fusebox/ | ||
|
||
# DynamoDB Local files | ||
.dynamodb/ | ||
|
||
# TernJS port file | ||
.tern-port | ||
|
||
# Stores VSCode versions used for testing VSCode extensions | ||
.vscode-test | ||
|
||
# yarn v2 | ||
.yarn/cache | ||
.yarn/unplugged | ||
.yarn/build-state.yml | ||
.yarn/install-state.gz | ||
.pnp.* | ||
|
||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
21.7.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
v20.9.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.next |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = require('eslint-config-mantine/.prettierrc.js'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import type { StorybookConfig } from '@storybook/nextjs'; | ||
|
||
const config: StorybookConfig = { | ||
stories: ['../components/**/*.(stories|story).@(js|jsx|ts|tsx)'], | ||
addons: [ | ||
'@storybook/addon-essentials', | ||
'storybook-dark-mode', | ||
'@storybook/addon-styling-webpack', | ||
], | ||
framework: { | ||
name: '@storybook/nextjs', | ||
options: {}, | ||
}, | ||
}; | ||
|
||
export default config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import '@mantine/core/styles.css'; | ||
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'; | ||
|
||
const channel = addons.getChannel(); | ||
|
||
function ColorSchemeWrapper({ children }: { children: React.ReactNode }) { | ||
const { setColorScheme } = useMantineColorScheme(); | ||
const handleColorScheme = (value: boolean) => setColorScheme(value ? 'dark' : 'light'); | ||
|
||
useEffect(() => { | ||
channel.on(DARK_MODE_EVENT_NAME, handleColorScheme); | ||
return () => channel.off(DARK_MODE_EVENT_NAME, handleColorScheme); | ||
}, [channel]); | ||
|
||
return <>{children}</>; | ||
} | ||
|
||
export const decorators = [ | ||
(renderStory: any) => <ColorSchemeWrapper>{renderStory()}</ColorSchemeWrapper>, | ||
(renderStory: any) => <MantineProvider theme={theme}>{renderStory()}</MantineProvider>, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.next | ||
out |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"extends": ["stylelint-config-standard-scss"], | ||
"rules": { | ||
"custom-property-pattern": null, | ||
"selector-class-pattern": null, | ||
"scss/no-duplicate-mixins": null, | ||
"declaration-empty-line-before": null, | ||
"declaration-block-no-redundant-longhand-properties": null, | ||
"alpha-value-notation": null, | ||
"custom-property-empty-line-before": null, | ||
"property-no-vendor-prefix": null, | ||
"color-function-notation": null, | ||
"length-zero-no-unit": null, | ||
"selector-not-notation": null, | ||
"no-descending-specificity": null, | ||
"comment-empty-line-before": null, | ||
"scss/at-mixin-pattern": null, | ||
"scss/at-rule-no-unknown": null, | ||
"value-keyword-case": null, | ||
"media-feature-range-notation": null, | ||
"selector-pseudo-class-no-unknown": [ | ||
true, | ||
{ | ||
"ignorePseudoClasses": ["global"] | ||
} | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"eslint.validate": [ | ||
"javascript", | ||
"javascriptreact", | ||
"typescript", | ||
"typescriptreact" | ||
], | ||
"editor.codeActionsOnSave": { | ||
"source.fixAll.eslint": "explicit" | ||
}, | ||
"typescript.tsdk": "node_modules/typescript/lib" | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
nodeLinker: node-modules | ||
|
||
yarnPath: .yarn/releases/yarn-4.1.1.cjs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import '@/styles/globals.css'; | ||
import '@mantine/core/styles.css'; | ||
import React from 'react'; | ||
import { MantineProvider, ColorSchemeScript } from '@mantine/core'; | ||
import { theme } from '../theme'; | ||
|
||
export const metadata = { | ||
title: 'Mantine Next.js template', | ||
description: 'I am using Mantine with Next.js!', | ||
}; | ||
|
||
export default function RootLayout({ children }: { children: any }) { | ||
return ( | ||
<html lang="en"> | ||
<head> | ||
<ColorSchemeScript /> | ||
<link rel="shortcut icon" href="/favicon.svg" /> | ||
<meta | ||
name="viewport" | ||
content="minimum-scale=1, initial-scale=1, width=device-width, user-scalable=no" | ||
/> | ||
</head> | ||
<body> | ||
<MantineProvider theme={theme}>{children}</MantineProvider> | ||
</body> | ||
</html> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { Welcome } from '@/components/Welcome/Welcome'; | ||
import { ColorSchemeToggle } from '@/components/ColorSchemeToggle/ColorSchemeToggle'; | ||
|
||
export default function HomePage() { | ||
return ( | ||
<> | ||
<Welcome /> | ||
<ColorSchemeToggle /> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
@tailwind components; | ||
@tailwind utilities; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
'use client'; | ||
|
||
import { Button, Group, useMantineColorScheme } from '@mantine/core'; | ||
|
||
export function ColorSchemeToggle() { | ||
const { setColorScheme } = useMantineColorScheme(); | ||
|
||
return ( | ||
<Group justify="center" mt="xl"> | ||
<Button onClick={() => setColorScheme('light')}>Light</Button> | ||
<Button onClick={() => setColorScheme('dark')}>Dark</Button> | ||
<Button onClick={() => setColorScheme('auto')}>Auto</Button> | ||
</Group> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
.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); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { Welcome } from './Welcome'; | ||
|
||
export default { | ||
title: 'Welcome', | ||
}; | ||
|
||
export const Usage = () => <Welcome />; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { render, screen } from '@/test-utils'; | ||
import { Welcome } from './Welcome'; | ||
|
||
describe('Welcome component', () => { | ||
it('has correct Next.js theming section link', () => { | ||
render(<Welcome />); | ||
expect(screen.getByText('this guide')).toHaveAttribute( | ||
'href', | ||
'https://mantine.dev/guides/next/' | ||
); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { Title, Text, Anchor } from '@mantine/core'; | ||
import classes from './Welcome.module.css'; | ||
|
||
export function Welcome() { | ||
return ( | ||
<> | ||
<Title className={classes.title} ta="center" mt={100}> | ||
Welcome to{' '} | ||
<Text inherit variant="gradient" component="span" gradient={{ from: 'pink', to: 'yellow' }}> | ||
Mantine | ||
</Text> | ||
</Title> | ||
<Text c="dimmed" ta="center" size="lg" maw={580} mx="auto" mt="xl"> | ||
This starter Next.js project includes a minimal setup for server side rendering, if you want | ||
to learn more on Mantine + Next.js integration follow{' '} | ||
<Anchor href="https://mantine.dev/guides/next/" size="lg"> | ||
this guide | ||
</Anchor> | ||
. To get started edit page.tsx file. | ||
</Text> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
const nextJest = require('next/jest'); | ||
|
||
const createJestConfig = nextJest({ | ||
dir: './', | ||
}); | ||
|
||
const customJestConfig = { | ||
setupFilesAfterEnv: ['<rootDir>/jest.setup.cjs'], | ||
moduleNameMapper: { | ||
'^@/components/(.*)$': '<rootDir>/components/$1', | ||
'^@/pages/(.*)$': '<rootDir>/pages/$1', | ||
}, | ||
testEnvironment: 'jest-environment-jsdom', | ||
}; | ||
|
||
module.exports = createJestConfig(customJestConfig); |
Oops, something went wrong.