-
Notifications
You must be signed in to change notification settings - Fork 5
Buttonで利用する属性を選択できるようにして必要なスタイルのみをmixinできるようにする #84
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
Conversation
b859f61 to
3ba2898
Compare
必要なスタイルのみを選択的に利用できるようにすることでビルドサイズを最適化できるようにする
3ba2898 to
d6017a6
Compare
fumink7
left a comment
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.
すごい、よさそうに思いました!✨
一つコメントしてます!!
packages/button/_mixins.scss
Outdated
| /// color: (primary, neutral), | ||
| /// size: (m, l) | ||
| /// )); | ||
| @mixin style-with-variants($default-style: variables.$default-option, $variants: ()) { |
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.
$default-styleを省略すること多そうなので、第一引数が$variantsのほうが良かったりします?
(名前付きで引数渡すなら関係ないですが…)
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.
そのほうがよさそうです。de1b6c5 で対応しました 🙏
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.
ありがとうございます!
nio-nio-nio
left a comment
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.
storybookで動作確認を行い、通常通りの挙動を確認したためApproveしました!🙏
実装内容も良さそうでした!
Buttonのmodifier的なスタイルを選択的にmixinできるようにします。これにより、必要なスタイルだけをビルド結果で得られるようにし、バンドルサイズを最適化できるようにします。
style-with-variantsというmixinを新たに定義し、以下のように役割を分けます。stylemixin: これまでどおりの機能を提供する (すべてのバリエーションのスタイルを提供)style-with-variantsmixin: デフォルトスタイルと必要な属性に対するスタイルを提供するこのようなパッチを入れると、Storybook上で選択的にスタイルをmixinできることを確認できます。この場合は、設定したappearanceとcolorとsize以外のすべての属性が無効(スタイルが適用されない)になります。