Repository navigation
🎨 style: ホバーで色が変わるときのトランジションをなくす #384
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
Merged
Changes from all commits
Commits
Show all changes
2 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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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,54 @@ | ||
| // コンポーネントのソースを読むので node 環境で動かす | ||
| // en: Runs in the node environment because it reads the component sources. | ||
| // @vitest-environment node | ||
| import fs from "node:fs"; | ||
| import path from "node:path"; | ||
| import { fileURLToPath } from "node:url"; | ||
|
|
||
| import { describe, it, expect } from "vitest"; | ||
|
|
||
| const COMPONENTS_DIR = path.resolve( | ||
| fileURLToPath(new URL(".", import.meta.url)), | ||
| "..", | ||
| "components", | ||
| "ui" | ||
| ); | ||
|
|
||
| const componentSources = fs | ||
| .readdirSync(COMPONENTS_DIR) | ||
| .filter(name => fs.existsSync(path.join(COMPONENTS_DIR, name, "index.tsx"))) | ||
| .map(name => ({ | ||
| name, | ||
| source: fs.readFileSync( | ||
| path.join(COMPONENTS_DIR, name, "index.tsx"), | ||
| "utf8" | ||
| ), | ||
| })); | ||
|
|
||
| /** | ||
| * ホバーの色の変化はトランジションで動かさない | ||
| * en: Hover color changes are not animated with transitions. | ||
| * | ||
| * ホバーは操作への即時の応答なので、色はすぐ切り替える。状態の変化に伴う色 | ||
| * (Switch のトラックなど)は、`--motion-color-*` で個別に動かす。 | ||
| * en: Hover is an immediate response to the pointer, so colors switch instantly. Colors that | ||
| * follow a state change (e.g. the Switch track) are animated individually with `--motion-color-*`. | ||
| */ | ||
| describe("hover transitions", () => { | ||
| // 状態の変化に伴う色をまだ Tailwind 標準の時間で動かしているもの。モーショントークンへの | ||
| // 置き換えで外していく | ||
| // en: Components still animating state-change colors with Tailwind's default timing. | ||
| // Remove each entry as it moves to the motion tokens. | ||
| const STATE_CHANGE_PENDING = new Set(["switch"]); | ||
|
|
||
| it("reads the component sources", () => { | ||
| expect(componentSources.length).toBeGreaterThan(20); | ||
| }); | ||
|
|
||
| it.each(componentSources.filter(c => !STATE_CHANGE_PENDING.has(c.name)))( | ||
| "$name does not use transition-colors / transition-all", | ||
| ({ source }) => { | ||
| expect(source).not.toMatch(/\btransition-(colors|all)\b/); | ||
| } | ||
| ); | ||
| }); |
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.
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.
コード例のコメントに英訳を追加してください。
追加したホバー色の方針を英語話者も読めるように、
en:付きの英訳を追加してください。As per coding guidelines: “Comments: Japanese first, then English with
en:prefix”。Source: Coding guidelines