-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from TeamWertarbyte/breaking/muiv5-and-typescript
feat: migrate to MUI v6 BREAKING CHANGE: Requires MUI v5 or v6
- Loading branch information
Showing
30 changed files
with
2,958 additions
and
10,267 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,18 @@ | ||
module.exports = { | ||
root: true, | ||
env: { browser: true, es2020: true }, | ||
extends: [ | ||
'eslint:recommended', | ||
'plugin:@typescript-eslint/recommended', | ||
'plugin:react-hooks/recommended', | ||
], | ||
ignorePatterns: ['dist', '.eslintrc.cjs'], | ||
parser: '@typescript-eslint/parser', | ||
plugins: ['react-refresh'], | ||
rules: { | ||
'react-refresh/only-export-components': [ | ||
'warn', | ||
{ allowConstantExport: true }, | ||
], | ||
}, | ||
} |
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,33 @@ | ||
name: 'Check PR' | ||
|
||
on: | ||
pull_request_target: | ||
types: | ||
- opened | ||
- synchronize | ||
- reopened | ||
|
||
jobs: | ||
check-code: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: '20' | ||
- name: Install dependencies | ||
run: yarn install --frozen-lockfile | ||
- name: Lint code | ||
run: yarn lint | ||
- name: Build library code | ||
run: yarn build | ||
check-versioning: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: amannn/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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,29 @@ | ||
name: 'Create release' | ||
|
||
on: [workflow_dispatch] | ||
|
||
jobs: | ||
release: | ||
name: Release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: '20' | ||
registry-url: 'https://registry.npmjs.org/' | ||
- name: Install dependencies | ||
run: yarn install --frozen-lockfile | ||
- name: Lint code | ||
run: yarn lint | ||
- name: Build library code | ||
run: yarn build | ||
- name: release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
run: npx semantic-release |
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 |
---|---|---|
@@ -1,5 +1,24 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
pnpm-debug.log* | ||
lerna-debug.log* | ||
|
||
node_modules | ||
dist | ||
dist-ssr | ||
*.local | ||
|
||
# Editor directories and files | ||
.vscode/* | ||
!.vscode/extensions.json | ||
.idea | ||
build | ||
lib | ||
coverage | ||
.DS_Store | ||
*.suo | ||
*.ntvs* | ||
*.njsproj | ||
*.sln | ||
*.sw? |
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 |
---|---|---|
@@ -1 +1,3 @@ | ||
**/* | ||
node_modules | ||
|
||
src/* |
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 @@ | ||
/node_modules | ||
/dist |
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,5 @@ | ||
{ | ||
"singleQuote": true, | ||
"trailingComma": "all", | ||
"endOfLine": "auto" | ||
} |
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,9 @@ | ||
{ | ||
"branches": ["main"], | ||
"plugins": [ | ||
"@semantic-release/commit-analyzer", | ||
"@semantic-release/release-notes-generator", | ||
"@semantic-release/github", | ||
"@semantic-release/npm" | ||
] | ||
} |
This file was deleted.
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
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
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,13 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<link rel="icon" type="image/svg+xml" href="/vite.svg" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Dots - React Material UI component</title> | ||
</head> | ||
<body> | ||
<div id="root"></div> | ||
<script type="module" src="/src/main.tsx"></script> | ||
</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,86 @@ | ||
import React, { useEffect, useState } from 'react'; | ||
import Paper from '@mui/material/Paper'; | ||
import Box from '@mui/material/Box'; | ||
import { SxProps, Theme } from '@mui/material/styles'; | ||
|
||
interface DotsProps { | ||
count: number; | ||
index: number; | ||
sx?: SxProps<Theme>; | ||
onDotClick?: ( | ||
index: number, | ||
event: React.MouseEvent<HTMLDivElement, MouseEvent>, | ||
) => void; | ||
} | ||
|
||
export const Dots: React.FC<DotsProps> = ({ count, index, sx, onDotClick }) => { | ||
const [previousIndex, setPreviousIndex] = useState<number>(index); | ||
|
||
useEffect(() => { | ||
if (index !== previousIndex) { | ||
const timeout = setTimeout(() => { | ||
setPreviousIndex(index); | ||
}, 400); | ||
return () => clearTimeout(timeout); | ||
} | ||
}, [index, previousIndex]); | ||
|
||
const handleDotClick = ( | ||
dotIndex: number, | ||
event: React.MouseEvent<HTMLDivElement, MouseEvent>, | ||
) => { | ||
if (onDotClick) { | ||
onDotClick(dotIndex, event); | ||
} | ||
}; | ||
|
||
return ( | ||
<Box sx={{ width: count * 16, ...sx }}> | ||
<Box sx={{ position: 'relative', padding: '20px 0 28px' }}> | ||
{[...Array(count).keys()].map((i) => ( | ||
<Box | ||
key={i} | ||
sx={{ | ||
width: 8, | ||
height: 8, | ||
padding: 0.5, | ||
position: 'absolute', | ||
left: i * 16, | ||
cursor: onDotClick ? 'pointer' : 'inherit', | ||
}} | ||
onClick={(event) => handleDotClick(i, event)} | ||
> | ||
<Paper | ||
elevation={0} | ||
sx={{ | ||
width: 8, | ||
height: 8, | ||
background: '#fff', | ||
borderRadius: 4, | ||
transition: 'all 400ms cubic-bezier(0.4, 0.0, 0.2, 1)', | ||
opacity: | ||
i >= Math.min(previousIndex, index) && | ||
i <= Math.max(previousIndex, index) | ||
? 0 | ||
: 0.5, | ||
}} | ||
/> | ||
</Box> | ||
))} | ||
<Paper | ||
elevation={0} | ||
sx={{ | ||
position: 'absolute', | ||
marginTop: 0.5, | ||
left: Math.min(previousIndex, index) * 16 + 4, | ||
width: Math.abs(previousIndex - index) * 16 + 8, | ||
height: 8, | ||
background: '#fff', | ||
borderRadius: 4, | ||
transition: 'all 400ms cubic-bezier(0.4, 0.0, 0.2, 1)', | ||
}} | ||
/> | ||
</Box> | ||
</Box> | ||
); | ||
}; |
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 @@ | ||
export * from './Dots.tsx'; |
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 @@ | ||
export * from './components/Dots'; |
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 @@ | ||
/// <reference types="vite/client" /> |
Oops, something went wrong.