-
Notifications
You must be signed in to change notification settings - Fork 10
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
ActionButtonに他カラーを追加 #302
ActionButtonに他カラーを追加 #302
Conversation
Deploy preview for ingred-ui ready! Built with commit dab0056 |
|
buttonがデフォルトでdisabledを持っているが、 |
modeではなくcolorという命名にして、デフォルトのdisabledを使う。 |
@hirokikondo86 Disabledにhoverした時のマウスカーソルの形状を、他のコンポーネントと同様にしてください |
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.
LGTM
export type ActionButtonColorStyle = { | ||
normal: { | ||
background: string; | ||
color: string; | ||
}; | ||
hover: { | ||
background: string; | ||
color: string; | ||
}; | ||
}; |
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.
これ、 export
する必要あるかな?このComponent以外で使ってなさそう
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.
使ってないですね…。
今後どこかで使うかもみたいな感覚で書いていたのですがやっぱよくないですよね…。
修正します…!
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.
使うことになったらexportすればいいよ!
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.
あ、ActionButtonColorStyle
はstyledで使ってました…!
ただ、上のActionButtonColor
は使ってないのでそっちを修正します!
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.
あーだとしたら、双方向でimportしてるのなんかおかしい気がする
お互いに依存しあっちゃってるな
const getBackgroundColor = (theme: Theme) => ({ | ||
primary: theme.palette.background.hint, | ||
warning: theme.palette.danger.highlight, | ||
disabled: theme.palette.gray.light, | ||
}); |
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.
関数名だけ見るとこいつ背景色全部取ってきそうなので、AtNormalとかの方が範囲狭められてよさそう。
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.
通常
normal
usual
common:
general
共通してないので、commonとかgeneralは違いそう。
usualもいつものっていう意味合いがありそうなので違いそう。
やっぱnormalなのかな…?
backgroundColorAtNormal: string; | ||
backgroundColorAtHover: string; |
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.
normalBackgroundColor: string;
hoverBackgroundColor: string;
の方が読みやすいかな
const getColorByDisabled = ( | ||
color: ColorProp, | ||
disabled?: boolean, | ||
): string => { |
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.
string
じゃなくて ColorProp | 'disabled'
みたいに厳格に型詰めていきましょう
}; | ||
|
||
const colorForStyle = getColorByDisabled(color, disabled); | ||
const normalBackgroundColor = getBackgroundColorAtNormal(theme)[ |
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.
getBackgroundColorAtNormal
は変えない?
const normalBackgroundColor = getBackgroundColorAtNormal(theme)[ | ||
colorForStyle | ||
]; | ||
const hoverBackgroundColor = getBackgroundColorAtHover(theme)[ |
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.
getBackgroundColorAtHover
こっちもかな
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.
完全に見逃してた…。修正します!🙇♂️
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.
LGTM 👍
Ref
DST #2715
XD
やったこと
スクショ
Before
After
確認方法
https://deploy-preview-302--ingred-ui.netlify.app/?path=/story/components-inputs-actionbutton--example