-
-
Notifications
You must be signed in to change notification settings - Fork 441
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a05af58
commit 314ae83
Showing
37 changed files
with
589 additions
and
20 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
18 changes: 18 additions & 0 deletions
18
apps/material-react-table-docs/examples/localization-i18n-zh-hans/index.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,18 @@ | ||
import React from 'react'; | ||
import { SourceCodeSnippet } from '../../components/mdx/SourceCodeSnippet'; | ||
import Example from './sandbox/src/TS'; | ||
const JS = require('!!raw-loader!./sandbox/src/JS.js').default; | ||
const TS = require('!!raw-loader!./sandbox/src/TS.tsx').default; | ||
|
||
const ExampleTable = () => { | ||
return ( | ||
<SourceCodeSnippet | ||
Component={Example} | ||
javaScriptCode={JS} | ||
typeScriptCode={TS} | ||
tableId="localization-i18n-zh-hans" | ||
/> | ||
); | ||
}; | ||
|
||
export default ExampleTable; |
5 changes: 5 additions & 0 deletions
5
apps/material-react-table-docs/examples/localization-i18n-zh-hans/sandbox/.gitignore
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 @@ | ||
node_modules | ||
.DS_Store | ||
dist | ||
dist-ssr | ||
*.local |
6 changes: 6 additions & 0 deletions
6
.../material-react-table-docs/examples/localization-i18n-zh-hans/sandbox/README.md
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,6 @@ | ||
# Example | ||
|
||
To run this example: | ||
|
||
- `npm install` or `yarn` | ||
- `npm run start` or `yarn start` |
13 changes: 13 additions & 0 deletions
13
apps/material-react-table-docs/examples/localization-i18n-zh-hans/sandbox/index.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,13 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Material React Table Example</title> | ||
</head> | ||
|
||
<body> | ||
<div id="root"></div> | ||
<script type="module" src="/src/main.tsx"></script> | ||
</body> | ||
</html> |
27 changes: 27 additions & 0 deletions
27
apps/material-react-table-docs/examples/localization-i18n-zh-hans/sandbox/package.json
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,27 @@ | ||
{ | ||
"name": "material-react-table-example-localization-i18n-zh-hans", | ||
"version": "0.0.0", | ||
"private": true, | ||
"scripts": { | ||
"dev": "vite --port 3001", | ||
"build": "vite build", | ||
"serve": "vite preview", | ||
"start": "vite" | ||
}, | ||
"dependencies": { | ||
"@emotion/react": "^11.10.4", | ||
"@emotion/styled": "^11.10.4", | ||
"@mui/icons-material": "^5.10.6", | ||
"@mui/material": "^5.10.6", | ||
"material-react-table": "^1.5.0", | ||
"react": "^18.2.0", | ||
"react-dom": "^18.2.0" | ||
}, | ||
"devDependencies": { | ||
"@types/react": "^18.0.20", | ||
"@types/react-dom": "^18.0.6", | ||
"@vitejs/plugin-react": "^2.1.0", | ||
"typescript": "^4.8.3", | ||
"vite": "^3.1.3" | ||
} | ||
} |
62 changes: 62 additions & 0 deletions
62
apps/material-react-table-docs/examples/localization-i18n-zh-hans/sandbox/src/JS.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,62 @@ | ||
import React from 'react'; | ||
|
||
//Import Material React Table and its Types | ||
import MaterialReactTable from 'material-react-table'; | ||
|
||
//Import Material React Table Translations | ||
import { MRT_Localization_ZH_HANS } from 'material-react-table/locales/zh-Hans'; | ||
|
||
//mock data | ||
import { data } from './makeData'; | ||
|
||
const columns = [ | ||
//column definitions... | ||
{ | ||
accessorKey: 'firstName', | ||
header: '名', | ||
}, | ||
{ | ||
accessorKey: 'lastName', | ||
header: '姓', | ||
enableClickToCopy: true, | ||
}, | ||
{ | ||
accessorKey: 'age', | ||
header: '年龄', | ||
}, | ||
//end | ||
]; | ||
|
||
const Example = () => { | ||
return ( | ||
<MaterialReactTable | ||
columns={columns} | ||
data={data} | ||
enableColumnFilterModes | ||
enableColumnOrdering | ||
enableEditing | ||
enablePinning | ||
enableRowActions | ||
enableRowSelection | ||
enableSelectAll={false} | ||
initialState={{ showColumnFilters: true, showGlobalFilter: true }} | ||
localization={MRT_Localization_ZH_HANS} | ||
/> | ||
); | ||
}; | ||
|
||
//App.tsx or similar | ||
import { createTheme, ThemeProvider, useTheme } from '@mui/material'; | ||
import { zhCN } from '@mui/material/locale'; | ||
|
||
const ExampleWithThemeProvider = () => { | ||
const theme = useTheme(); //replace with your theme/createTheme | ||
return ( | ||
//Setting Material UI locale as best practice to result in better accessibility | ||
<ThemeProvider theme={createTheme(theme, zhCN)}> | ||
<Example /> | ||
</ThemeProvider> | ||
); | ||
}; | ||
|
||
export default ExampleWithThemeProvider; |
62 changes: 62 additions & 0 deletions
62
apps/material-react-table-docs/examples/localization-i18n-zh-hans/sandbox/src/TS.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,62 @@ | ||
import React, { FC } from 'react'; | ||
|
||
//Import Material React Table and its Types | ||
import MaterialReactTable, { MRT_ColumnDef } from 'material-react-table'; | ||
|
||
//Import Material React Table Translations | ||
import { MRT_Localization_ZH_HANS } from 'material-react-table/locales/zh-Hans'; | ||
|
||
//mock data | ||
import { data, Person } from './makeData'; | ||
|
||
const columns: MRT_ColumnDef<Person>[] = [ | ||
//column definitions... | ||
{ | ||
accessorKey: 'firstName', | ||
header: '名', | ||
}, | ||
{ | ||
accessorKey: 'lastName', | ||
header: '姓', | ||
enableClickToCopy: true, | ||
}, | ||
{ | ||
accessorKey: 'age', | ||
header: '年龄', | ||
}, | ||
//end | ||
]; | ||
|
||
const Example: FC = () => { | ||
return ( | ||
<MaterialReactTable | ||
columns={columns} | ||
data={data} | ||
enableColumnFilterModes | ||
enableColumnOrdering | ||
enableEditing | ||
enablePinning | ||
enableRowActions | ||
enableRowSelection | ||
enableSelectAll={false} | ||
initialState={{ showColumnFilters: true, showGlobalFilter: true }} | ||
localization={MRT_Localization_ZH_HANS} | ||
/> | ||
); | ||
}; | ||
|
||
//App.tsx or similar | ||
import { createTheme, ThemeProvider, useTheme } from '@mui/material'; | ||
import { zhCN } from '@mui/material/locale'; | ||
|
||
const ExampleWithThemeProvider: FC = () => { | ||
const theme = useTheme(); //replace with your theme/createTheme | ||
return ( | ||
//Setting Material UI locale as best practice to result in better accessibility | ||
<ThemeProvider theme={createTheme(theme, zhCN)}> | ||
<Example /> | ||
</ThemeProvider> | ||
); | ||
}; | ||
|
||
export default ExampleWithThemeProvider; |
9 changes: 9 additions & 0 deletions
9
apps/material-react-table-docs/examples/localization-i18n-zh-hans/sandbox/src/main.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,9 @@ | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom/client'; | ||
import Example from './TS'; | ||
|
||
ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render( | ||
<React.StrictMode> | ||
<Example /> | ||
</React.StrictMode>, | ||
); |
23 changes: 23 additions & 0 deletions
23
apps/material-react-table-docs/examples/localization-i18n-zh-hans/sandbox/src/makeData.ts
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 @@ | ||
export type Person = { | ||
firstName: string; | ||
lastName: string; | ||
age: number; | ||
}; | ||
|
||
export const data: Person[] = [ | ||
{ | ||
firstName: 'Kevin', | ||
lastName: 'Vandy', | ||
age: 26, | ||
}, | ||
{ | ||
firstName: 'Theodore', | ||
lastName: 'Browne', | ||
age: 28, | ||
}, | ||
{ | ||
firstName: 'Tanner', | ||
lastName: 'Linsley', | ||
age: 33, | ||
}, | ||
]; |
1 change: 1 addition & 0 deletions
1
apps/material-react-table-docs/examples/localization-i18n-zh-hans/sandbox/src/vite.env.d.ts
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" /> |
31 changes: 31 additions & 0 deletions
31
apps/material-react-table-docs/examples/localization-i18n-zh-hans/sandbox/tsconfig.json
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,31 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "ESNext", | ||
"useDefineForClassFields": true, | ||
"lib": [ | ||
"DOM", | ||
"DOM.Iterable", | ||
"ESNext" | ||
], | ||
"allowJs": true, | ||
"skipLibCheck": true, | ||
"esModuleInterop": false, | ||
"allowSyntheticDefaultImports": true, | ||
"strict": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"module": "ESNext", | ||
"moduleResolution": "Node", | ||
"resolveJsonModule": true, | ||
"isolatedModules": true, | ||
"noEmit": true, | ||
"jsx": "react-jsx" | ||
}, | ||
"include": [ | ||
"src" | ||
], | ||
"references": [ | ||
{ | ||
"path": "./tsconfig.node.json" | ||
} | ||
] | ||
} |
8 changes: 8 additions & 0 deletions
8
apps/material-react-table-docs/examples/localization-i18n-zh-hans/sandbox/tsconfig.node.json
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,8 @@ | ||
{ | ||
"compilerOptions": { | ||
"composite": true, | ||
"module": "ESNext", | ||
"moduleResolution": "Node" | ||
}, | ||
"include": ["vite.config.ts"] | ||
} |
7 changes: 7 additions & 0 deletions
7
apps/material-react-table-docs/examples/localization-i18n-zh-hans/sandbox/vite.config.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,7 @@ | ||
import { defineConfig } from 'vite'; | ||
import react from '@vitejs/plugin-react'; | ||
|
||
// https://vitejs.dev/config/ | ||
export default defineConfig({ | ||
plugins: [react()], | ||
}); |
18 changes: 18 additions & 0 deletions
18
apps/material-react-table-docs/examples/localization-i18n-zh-hant/index.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,18 @@ | ||
import React from 'react'; | ||
import { SourceCodeSnippet } from '../../components/mdx/SourceCodeSnippet'; | ||
import Example from './sandbox/src/TS'; | ||
const JS = require('!!raw-loader!./sandbox/src/JS.js').default; | ||
const TS = require('!!raw-loader!./sandbox/src/TS.tsx').default; | ||
|
||
const ExampleTable = () => { | ||
return ( | ||
<SourceCodeSnippet | ||
Component={Example} | ||
javaScriptCode={JS} | ||
typeScriptCode={TS} | ||
tableId="localization-i18n-zh-hant" | ||
/> | ||
); | ||
}; | ||
|
||
export default ExampleTable; |
5 changes: 5 additions & 0 deletions
5
apps/material-react-table-docs/examples/localization-i18n-zh-hant/sandbox/.gitignore
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 @@ | ||
node_modules | ||
.DS_Store | ||
dist | ||
dist-ssr | ||
*.local |
6 changes: 6 additions & 0 deletions
6
.../material-react-table-docs/examples/localization-i18n-zh-hant/sandbox/README.md
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,6 @@ | ||
# Example | ||
|
||
To run this example: | ||
|
||
- `npm install` or `yarn` | ||
- `npm run start` or `yarn start` |
13 changes: 13 additions & 0 deletions
13
apps/material-react-table-docs/examples/localization-i18n-zh-hant/sandbox/index.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,13 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Material React Table Example</title> | ||
</head> | ||
|
||
<body> | ||
<div id="root"></div> | ||
<script type="module" src="/src/main.tsx"></script> | ||
</body> | ||
</html> |
27 changes: 27 additions & 0 deletions
27
apps/material-react-table-docs/examples/localization-i18n-zh-hant/sandbox/package.json
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,27 @@ | ||
{ | ||
"name": "material-react-table-example-localization-i18n-zh-hant", | ||
"version": "0.0.0", | ||
"private": true, | ||
"scripts": { | ||
"dev": "vite --port 3001", | ||
"build": "vite build", | ||
"serve": "vite preview", | ||
"start": "vite" | ||
}, | ||
"dependencies": { | ||
"@emotion/react": "^11.10.4", | ||
"@emotion/styled": "^11.10.4", | ||
"@mui/icons-material": "^5.10.6", | ||
"@mui/material": "^5.10.6", | ||
"material-react-table": "^1.5.0", | ||
"react": "^18.2.0", | ||
"react-dom": "^18.2.0" | ||
}, | ||
"devDependencies": { | ||
"@types/react": "^18.0.20", | ||
"@types/react-dom": "^18.0.6", | ||
"@vitejs/plugin-react": "^2.1.0", | ||
"typescript": "^4.8.3", | ||
"vite": "^3.1.3" | ||
} | ||
} |
Oops, something went wrong.
314ae83
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
material-react-table-storybook – ./
material-react-table-storybook.vercel.app
material-react-table-storybook-git-main-kevinvandy.vercel.app
material-react-table-storybook-kevinvandy.vercel.app
material-react-table.dev
www.material-react-table.dev
314ae83
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
material-react-table – ./apps/material-react-table-docs
material-react-table-git-main-kevinvandy.vercel.app
material-react-table-kevinvandy.vercel.app
www.material-react-table.com
material-react-table.vercel.app
material-react-table.com