-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
テーブル機能を実装 #6
Merged
Merged
テーブル機能を実装 #6
Changes from 1 commit
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
170b4a7
フィルタの項目を追加、画面左右に余白を追加
ymd1138 17750dd
テーブルの全項目に対してフィルタ機能を追加、有効期限のフォーマットを修正
ymd1138 c720d3b
チェックボックスのコードをReact Bootstrapへ変更
ymd1138 ce061ff
一部の項目がデフォルトで表示されるように修正、Containerを追加
ymd1138 e120eed
セミコロンを削除
ymd1138 437fd96
チェックボックスを横並びに修正、importのcurly bracketsを修正
ymd1138 4717367
defaultCheckedのコードをリファクタリング、marginをpaddingに修正、など
ymd1138 0bf8200
CSSをInline Stylesに変更
ymd1138 62926b0
メモを削除、importを最適に、幅表記を統一
MogamiTsuchikawa afa9c63
エラー対応処理を追加
MogamiTsuchikawa f4cc058
discordUserIdの表示幅を修正
MogamiTsuchikawa e5a5021
styleのwidthにpxがつけ忘れている部分を修正
MogamiTsuchikawa File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
|
@@ -14,29 +14,49 @@ const UsersPage = ({ users }: Props) => { | |
const [selectTypes, setSelectTypes] = useState<TableDataType[]>([]); | ||
const onCheckFilter = (checked: boolean, type: TableDataType) => { | ||
if (checked) setSelectTypes([...selectTypes, type]); | ||
else setSelectTypes(selectTypes.filter(t => t !== type)); | ||
} | ||
else setSelectTypes(selectTypes.filter((t) => t !== type)); | ||
}; | ||
return ( | ||
<div style={{ width: "100%" }} className="overflow-auto"> | ||
{allTableDataTypes.map(t => ( | ||
<div style={{ width: "90vw", margin: "auto" }} className="overflow-auto"> | ||
{allTableDataTypes.map((t) => ( | ||
<> | ||
<input type="checkbox" key={t} onChange={(e) => { onCheckFilter(e.target.checked, t) }} /> | ||
<input | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. このまま標準の使いにくいinput使うんですか?Bootstrapのcheckboxを利用してください。 |
||
type="checkbox" | ||
key={t} | ||
onChange={(e) => { | ||
onCheckFilter(e.target.checked, t); | ||
}} | ||
/> | ||
{t} | ||
</> | ||
))} | ||
<Table striped bordered hover style={{ tableLayout: "fixed" }}> | ||
<Table | ||
striped | ||
bordered | ||
hover | ||
style={{ tableLayout: "fixed", overflow: "scroll" }} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. overflowはscrollだとX,Yどちらもスクロールが出てしまいます。autoにして必要な部分だけ表示されるようにしてください |
||
> | ||
<thead> | ||
<tr> | ||
{ | ||
// 幅は調整中。細かい調整は後ほど。 | ||
} | ||
{selectTypes.indexOf("id") !== -1 ? <th style={{ width: 150 }}>ID</th> : <></>} | ||
|
||
{/* 幅は調整中。細かい調整は後ほど。*/} | ||
{selectTypes.indexOf("id") !== -1 ? ( | ||
<th style={{ width: 150 }}>ID</th> | ||
) : ( | ||
<></> | ||
)} | ||
<th className="table-th-studentNumber">学籍番号</th> | ||
<th className="table-th-username">ユーザー名</th> | ||
<th style={{ width: 30 }}>学年</th> | ||
<th style={{ width: 66 }}>アイコン</th> | ||
<th style={{ width: 100 }}>Discord ID</th> | ||
{selectTypes.indexOf("icon") !== -1 ? ( | ||
<th style={{ width: 66 }}>アイコン</th> | ||
) : ( | ||
<></> | ||
)} | ||
{selectTypes.indexOf("discord") !== -1 ? ( | ||
<th style={{ width: 100 }}>Discord ID</th> | ||
) : ( | ||
<></> | ||
)} | ||
<th style={{ width: 100 }}>有効期限</th> | ||
<th style={{ width: 150 }}>自己紹介</th> | ||
<th className="table-th-name">名字</th> | ||
|
@@ -56,14 +76,21 @@ const UsersPage = ({ users }: Props) => { | |
{users.map((user) => ( | ||
<tr key={user.id}> | ||
{selectTypes.indexOf("id") !== -1 ? <td>{user.id}</td> : <></>} | ||
|
||
<td>{user.studentNumber}</td> | ||
<td>{user.username}</td> | ||
<td>{user.schoolGrade}</td> | ||
<td> | ||
<img src={user.iconUrl} alt="" style={{ width: "50px" }} /> | ||
</td> | ||
<td>{user.discordUserId}</td> | ||
{selectTypes.indexOf("icon") !== -1 ? ( | ||
<td> | ||
<img src={user.iconUrl} alt="" style={{ width: "50px" }} /> | ||
</td> | ||
) : ( | ||
<></> | ||
)} | ||
{selectTypes.indexOf("discord") !== -1 ? ( | ||
<td>{user.discordUserId}</td> | ||
) : ( | ||
<></> | ||
)} | ||
<td>{user.activeLimit}</td> | ||
<td>{user.shortIntroduction}</td> | ||
<td>{user.firstName}</td> | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
左右に余白を作りたいのであれば、そもそもbootstrapのcontainerなりをしっかり利用してください。使い方などはDBのページを参考にしてください。