-
-
Notifications
You must be signed in to change notification settings - Fork 10
chore(ui): Make button group responsive in task table (#2781) #2782
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
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
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
67 changes: 67 additions & 0 deletions
67
docs/dev-notes/2025-11-02/make-button-group-responsive/plan.md
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| # Button Group のレスポンシブ化 | ||
|
|
||
| ## 問題 | ||
|
|
||
| 640px未満の画面でボタングループの文字が縦に潰れてしまう | ||
|
|
||
| ## 解決方法 | ||
|
|
||
| Tailwind CSSのレスポンシブクラスを使用してボタンの折り返しと配置を実装 | ||
|
|
||
| ## コード変更 | ||
|
|
||
| ### 修正前 | ||
|
|
||
| ```svelte | ||
| <ButtonGroup class="m-4 contents-center"> | ||
| ``` | ||
|
|
||
| ### 修正後 | ||
|
|
||
| ```svelte | ||
| <div class="flex justify-center m-4"> | ||
| <ButtonGroup class="flex flex-wrap justify-start gap-1 shadow-none"> | ||
| {#each Object.entries(contestTableProviderGroups) as [type, config]} | ||
| <Button | ||
| onclick={() => updateActiveContestType(type as ContestTableProviderGroups)} | ||
| class={`rounded-lg ${activeContestType === (type as ContestTableProviderGroups) | ||
| ? 'active-button-class text-primary-700 dark:!text-primary-500' | ||
| : ''}`} | ||
| aria-label={config.getMetadata().ariaLabel} | ||
| > | ||
| {config.getMetadata().buttonLabel} | ||
| </Button> | ||
| {/each} | ||
| </ButtonGroup> | ||
| </div> | ||
| ``` | ||
|
|
||
| ## 使用クラス一覧 | ||
|
|
||
| | クラス | 役割 | | ||
| | ---------------- | ------------------------------------------- | | ||
| | `flex` | Flexboxコンテナを有効化 | | ||
| | `flex-wrap` | 画面幅に応じてボタンを折り返す | | ||
| | `justify-center` | ボタングループ全体を水平中央揃え(外側div) | | ||
| | `justify-start` | ボタン自体を左寄せ(ButtonGroup内) | | ||
| | `gap-1` | ボタン間のスペーシング(0.25rem) | | ||
| | `rounded-lg` | ボタンの角に丸みを付与 | | ||
| | `shadow-none` | デフォルトシャドウを削除 | | ||
|
|
||
| ## 注記 | ||
|
|
||
| `ButtonGroup`コンポーネントのデフォルトスタイルにシャドウが含まれているため、`shadow-none`クラスを追加してそれらを打ち消す必要があります。 | ||
|
|
||
| ## 参考資料 | ||
|
|
||
| - [Tailwind CSS - Flex Wrap](https://tailwindcss.com/docs/flex-wrap) | ||
| - [Tailwind CSS - Justify Content](https://tailwindcss.com/docs/justify-content) | ||
| - [Tailwind CSS - Gap](https://tailwindcss.com/docs/gap) | ||
| - [Tailwind CSS - Border Radius](https://tailwindcss.com/docs/border-radius) | ||
| - [Tailwind CSS - Box Shadow](https://tailwindcss.com/docs/box-shadow) | ||
|
|
||
| ## 使用ライブラリ | ||
|
|
||
| - Tailwind CSS | ||
| - Flowbite | ||
| - svelte-5-ui-lib | ||
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.