This file contains hidden or 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
my-next-app/ | |
├── public/ | |
│ └── favicon.ico | |
├── src/ | |
│ ├── app/ | |
│ │ ├── layout.tsx # 共通レイアウト(ルート) | |
│ │ ├── page.tsx # トップページ | |
│ │ ├── about/ | |
│ │ │ └── page.tsx # /about ページ | |
│ │ └── api/ |
This file contains hidden or 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
function parseJSTDate(dateString: string): Date | null { | |
// 正規表現を使用して日付と時刻の情報を取得 | |
const match = /(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/.exec(dateString); | |
if (!match) { | |
return null; | |
} | |
// 取得した情報を使用して新しいDateオブジェクトを作成 | |
const year = parseInt(match[1], 10); |
This file contains hidden or 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
function mergeObjects(objA, objB) { | |
const keys = new Set([...Object.keys(objA), ...Object.keys(objB)]); | |
const result = {}; | |
keys.forEach(key => { | |
result[key] = objB[key] !== undefined ? objB[key] : objA[key]; | |
}); | |
return result; | |
} |
This file contains hidden or 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
const EditableCell: React.FC<any> = ({ row, field, control }) => { | |
return ( | |
<Controller | |
name={`${row.id}.${field}`} | |
control={control} | |
render={({ field: { ref, ...inputProps }, fieldState: { invalid, error } }) => ( | |
<TextField | |
{...inputProps} | |
error={invalid} | |
helperText={error?.message} |
This file contains hidden or 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
^(?=.*[A-Z])(?=.*[a-z])(?=.*\d)[A-Za-z0-9^$*.[\]{}()?"!@#%&/\\,><':;|_~`=+\- ]{8,256}$ |
This file contains hidden or 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
import React from 'react'; | |
import { makeStyles } from '@material-ui/core/styles'; | |
import Table from '@material-ui/core/Table'; | |
import TableBody from '@material-ui/core/TableBody'; | |
import TableCell from '@material-ui/core/TableCell'; | |
import TableContainer from '@material-ui/core/TableContainer'; | |
import TableHead from '@material-ui/core/TableHead'; | |
import TableRow from '@material-ui/core/TableRow'; | |
import Paper from '@material-ui/core/Paper'; |
This file contains hidden or 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
sortComparator: (v1, v2, param1, param2) => { | |
if (v1 !== v2) { | |
// isCheckedの値が異なる場合、そのまま比較結果を返す | |
return v1 ? -1 : 1; | |
} | |
// isCheckedが同じ場合、isSelectedを比較する | |
const isSelected1 = param1.api.getRow(param1.id).isSelected; | |
const isSelected2 = param2.api.getRow(param2.id).isSelected; | |
if (isSelected1 !== isSelected2) { | |
// isSelectedの値が異なる場合、そのまま比較結果を返す |
This file contains hidden or 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
import React, { useState } from "react"; | |
import { DataGrid, GridColDef, GridRowsProp, GridColumns } from "@mui/x-data-grid"; | |
interface PinnedColumnsDataGridProps { | |
rows: GridRowsProp; | |
columns: GridColDef[]; | |
columnVisibilityModel: GridColumns; | |
onColumnVisibilityModelChange: (model: GridColumns) => void; | |
} |
This file contains hidden or 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
import React from 'react'; | |
import { withRouter } from 'next/router'; | |
// 型修正 | |
export const withComponentRouter = (Component: any) => { | |
return withRouter(({ router, ...props }) => { | |
// split at first `?` | |
const searchParams = new URLSearchParams(router.asPath.split(/\?/)[1]); | |
const query: { [key: string]: string } = {}; |
This file contains hidden or 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
image: node:11.10.1 | |
stages: | |
- test | |
run-unit-test: | |
stage: test | |
script: | |
- npm install # Install all dependencies | |
- npm test # Test |
NewerOlder