Skip to content

Commit

Permalink
Merge pull request #23 from Sports-day/feature/filter-by-username
Browse files Browse the repository at this point in the history
ページネーション及びNext/LinkによるUX改善
  • Loading branch information
testusuke authored Apr 24, 2024
2 parents 1863ee6 + 46c5297 commit 473167c
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 4 deletions.
15 changes: 15 additions & 0 deletions components/users/userLinkRenderer.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import {ICellRendererParams} from "ag-grid-community";
import Link from "next/link";

export default function UserLinkRenderer(param: ICellRendererParams) {
return (
<Link
href={`/users/${param.value}`}
style={{
width: '100%',
}}
>
{param.value}
</Link>
)
}
27 changes: 23 additions & 4 deletions components/users/usersAgGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {User} from "@/src/models/UserModel";
import {Class} from '@/src/models/ClassModel';
import {Team} from "@/src/models/TeamModel";
import {useRouter} from "next/navigation";
import UserLinkRenderer from "@/components/users/userLinkRenderer";

ModuleRegistry.registerModules([ClientSideRowModelModule]);

Expand Down Expand Up @@ -38,11 +39,27 @@ const UsersAgGrid = (props: UsersAgGridProps) => {
const [rowData, setRowData] = useState<IRow[]>([])
// Column Definitions: Defines & controls grid columns.
const [colDefs,] = useState<ColDef<IRow>[]>([
{field: "userId", headerName: "ユーザーID"},
{field: "name", headerName: "名前"},
{field: "emailAccountName", headerName: "メール名"},
{
field: "userId",
headerName: "ユーザーID",
cellRenderer: UserLinkRenderer,
},
{
field: "name",
headerName: "名前",
filter: true,
},
{
field: "emailAccountName",
headerName: "メール名",
filter: true,
},
{field: "gender", headerName: "性別"},
{field: "className", headerName: "クラス"},
{
field: "className",
headerName: "クラス",
filter: true,
},
{field: "studentTeam", headerName: "チーム"},
]);

Expand Down Expand Up @@ -92,6 +109,8 @@ const UsersAgGrid = (props: UsersAgGridProps) => {
rowData={rowData}
columnDefs={colDefs}
onRowClicked={handleRowClick}
pagination={true}
paginationAutoPageSize={true}
/>
</div>
);
Expand Down

0 comments on commit 473167c

Please sign in to comment.