-
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
Notification Badgeの追加 #31
Conversation
export type Props = { | ||
content?: number | string; | ||
position?: Styled.BadgeProps["position"]; | ||
size?: Styled.BadgeProps["size"]; | ||
max?: number; | ||
}; |
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.
依存の方向を1つにしたいので、styled.ts
に型を置いている。。
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.
型はNotificationBadge.tsxに置きたいな
styled側で三項演算子でstyle変えてるけど、判定後の値を渡すのではダメなんだろうか?
参考
ingred-ui/src/components/Button/Button.tsx
Line 123 in 1633295
fontWeight={color === "cancel" ? "normal" : "bold"} |
background-color: ${({ theme }) => theme.palette.danger.main}; | ||
font-size: 0.75rem; | ||
font-weight: bold; | ||
z-index: 1; |
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.
<Container />
でz-index
指定していないので、全体に影響することはない。
Material-UIのBadgeで指定されていたから追加したけど、いらないような...:thinking:
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.
不要なら消そう?
border-radius: 10rem; | ||
color: ${({ theme }) => theme.palette.text.white}; | ||
background-color: ${({ theme }) => theme.palette.danger.main}; | ||
font-size: 0.75rem; |
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.
今回はMaterial-UIにならってrem
指定なのですが、相対値指定でのデメリットってありますかね...?
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.
ingred-ui上でremにしないといけない理由があるのならそれで大丈夫だよ
inngred-uiではhtmlのfont-sizeに干渉しないので意図したsizeになるかは気になる
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.
htmlのfont-sizeに干渉しないので意図したsizeになるかは気になる
確かにそうなので、pxで固定します!!
size変えたいニーズが出てきた時点で、修正を加える予定。
variant === "normal" ? "20px" : dotSizeMapping[size]}; | ||
min-width: ${({ variant, size }) => | ||
variant === "normal" ? "20px" : dotSizeMapping[size]}; | ||
padding: 0 ${({ variant }) => (variant === "normal" ? "6px" : 0)} 1px; |
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.
末尾の1pxは指摘があって当てたのですが↓
https://cartaholdings.slack.com/archives/CKYAWNNLX/p1589886510429700?thread_ts=1589882789.427700&cid=CKYAWNNLX
なぜ1pxずれるのかがわからない....
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.
line-height: 1にしたら直ったりしないかな?
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.
直らなかったです...
他の要素に影響はなさそうなので、このままでも良いかなという判断。
※以降もコメは返していきますが、急ぎではないので返信は明日でも大丈夫です!!一気に評価会資料書いちゃってください!!! 端を軸にすると、ある程度大きい要素にBadgeつけた時に違和感がある気がしています...
なので、現行のままでいきたいです!!! |
ありがとう!!!:sob::sob::sob: |
Drawerをingred-uiに乗っける時のココ↓に使えそうなので、お手隙でみていただけると:bow: |
0257e1f
to
f91bf09
Compare
sizeがdotの時しか反映されないのが気になった |
vertical-align: middle; | ||
`; | ||
|
||
export type BadgeProps = { |
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.
使わなくなって、対応漏れですね...
XDに3サイズ書かれてあったので、可変だという判断でした。 |
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.
ほぼMaterial-uiになりました。
line-height: 1; | ||
padding: 0 ${({ variant }) => (variant === "normal" ? "6px" : 0)}; |
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.
line-height
当てたんですけど、変わってますかね....?
僕見た感じ、変わってなくて...
border-radius: 10rem; | ||
color: ${({ theme }) => theme.palette.text.white}; | ||
background-color: ${({ theme }) => theme.palette.danger.main}; | ||
font-size: 10.5px; | ||
font-weight: bold; | ||
transition: transform 0.3s; |
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.
badgeが消える時にアニメーションがつくようになりました
@kinokoruumu お手隙でご確認ください:bow: |
@kinokoruumu よって、現行のままで問題ないと思います:bow: |
| { | ||
variant: "normal"; | ||
badgeContent: number; | ||
dotSize?: never; |
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.
なんでneverにしてるんだろう?
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.
あ、この辺variant
をoptionalにしない代わりに型を動的に変えるようにしてみました。
上のコードだと「variant
がnormal
の時にはdotSize
を定義できない」ようにしたいのでnever
型が適切だと考えたのですが、他に良い型あったりしますかね...??
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.
OmitかExcludeで実現できないだろうか?
export type Props =
| ({
variant: "dot";
} & Omit<BaseProps, "BadgeContent" | "max" | "showZero">)
| ({
variant: "normal";
badgeContent: number;
} & Omit<BaseProps, "dotSize">)
| ({
variant: "normal";
badgeContent: string;
} & Omit<BaseProps, "max" | "dotSize" | "showZero">); これだと |
|
ということで元に戻しました。 |
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.
neverはちょっと自分でも調べてみる!
このPRとしてはLGTMです!
No description provided.