- ランダムな色を 5 回選びその平均をとった色を表示するアプリケーション
miso-devel / favorite-color-recommend Goto Github PK
View Code? Open in Web Editor NEWHome Page: https://color-recommender.netlify.app/
Home Page: https://color-recommender.netlify.app/
そこまで大規模なアプリでないのとユーザーが操作する部分がそこまで多くないので結合テストがいい気がする
divをbuttonの中に入れて解決
colorを引数に渡してstateに保存する
colorを引数に渡すとき表示されてる色とその色は同一でなければならないのでコンポーネントで分けるしかないのか
const colorModels = [
"XYZ",
"cmyk",
"hsv",
"hex",
"name",
"hsl",
"rgb"
] as const;
type colorModel = typeof colorModels[number];
type State = {
color: number[][]
result: {
[C in colorModel]: {
value: string
}
}
}
汎用的なメソッドを置くディレクトリ名はutil
が一般的だと思ってます。
https://github.com/nisi0929/favorite-color-recommend/tree/6d029ec9c18e806311cacf9698ce692a4715a6a4/src/methods
[細かい]t
がマジックナンバーかつ変数名から意味が取れないのでMIN
やMAX
のように定数化するかコメントで補足するかした方が良いと思います。(i
も同じ)
https://github.com/nisi0929/favorite-color-recommend/blob/6d029ec9c18e806311cacf9698ce692a4715a6a4/src/methods/RandomColor.ts#L5
[細かい] https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Global_Objects/Array/map#when_not_to_use_map に該当するのでforEach
の方が適切です。
Math.round
を別関数に切り出してその関数をモックします。イメージ: https://wafuwafu13.hatenadiary.com/entry/2021/03/01/121427 の序盤value
という変数名を設定しなかったらRedux Toolkitは動作しないとかありますか?同じvalue
というキーを持っているのは冗長のように思えました。result: {
XYZ: ""
cmyk: ""
...
[感想]
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.