Skip to content
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

Feat/update toast #482

Merged
merged 1 commit into from
Aug 18, 2022
Merged

Feat/update toast #482

merged 1 commit into from
Aug 18, 2022

Conversation

keiya01
Copy link
Contributor

@keiya01 keiya01 commented Jul 19, 2022

Toastをアップデートし、以下の要素を追加しました。

  • 先頭にinformation iconが表示されるようになりました
    • variant="information"の時は非表示できます
  • close buttonの追加
  • variantの追加(information, confirmation, error)
  • 複数表示のサポート
information confirmation error
Screen Shot 2022-07-19 at 18 23 36 Screen Shot 2022-07-19 at 18 24 07 Screen Shot 2022-07-19 at 18 24 23

TODO

  • approve後にcommitをまとめます
  • 今回のToastをベースにSnack Barを実装します

@reg-suit
Copy link

reg-suit bot commented Jul 19, 2022

reg-suit detected visual differences.

Check this report, and review them.

🔴🔴🔴🔴🔴
⚪⚪⚪⚪⚪⚪⚪

🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵

What do the circles mean? The number of circles represent the number of changed images.
🔴 : Changed items, ⚪ : New items, ⚫ : Deleted items, and 🔵 Passed items

How can I change the check status? If reviewers approve this PR, the reg context status will be green automatically.

@github-actions
Copy link
Contributor

github-actions bot commented Jul 19, 2022

Visit the preview URL for this PR (updated for commit d1dd07a):

https://ameba-spindle--pr482-feat-update-toast-jyt8819o.web.app

(expires Sat, 17 Sep 2022 03:25:49 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

@keiya01
Copy link
Contributor Author

keiya01 commented Jul 19, 2022

Toastのbundlesizeが1.1kbを超えてしまった、、

@@ -1,5 +1,31 @@
:root {
--Toast-z-index: 1;

/* Information */
--Toast-IconButton--information-color: var(
Copy link
Member

@herablog herablog Jul 19, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Q: スタイルをカスタマイズできる要望は結構ありそうですかな。Toastはvariantである程度スタイル分かれてるのでそれでよかったりしないか確認したいかもです!

Copy link
Contributor Author

@keiya01 keiya01 Jul 20, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

カスタマイズできなくて良さそうでした:pray:

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

修正しました!
757ae1e

packages/spindle-ui/src/Toast/Toast.css Show resolved Hide resolved
packages/spindle-ui/src/Toast/Toast.css Show resolved Hide resolved
packages/spindle-ui/src/Toast/Toast.css Outdated Show resolved Hide resolved
packages/spindle-ui/src/Toast/Toast.css Outdated Show resolved Hide resolved
packages/spindle-ui/src/Toast/Toast.tsx Outdated Show resolved Hide resolved
packages/spindle-ui/src/Toast/Toast.tsx Outdated Show resolved Hide resolved
packages/spindle-ui/src/Toast/Toast.tsx Outdated Show resolved Hide resolved
packages/spindle-ui/src/Toast/Toast.tsx Outdated Show resolved Hide resolved
Comment on lines +16 to +29
"path": "./dist/Toast/*.mjs",
"maxSize": "1.5 kB"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Toastのmjsだけbundlesize増やしました

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

くぅ、惜しいw

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

947b71f
ああ、、コンフリクトの解決おかしくなっていたので修正しました:bow:

@@ -1,6 +1,7 @@
import React, { useCallback, useEffect, useRef, useState } from 'react';
import { CheckCircleFill, CrossBold, Information } from '../Icon';
import { IconButton } from '../IconButton';
import '../IconButton/IconButton.css';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dialogと同様にIconButton.cssはToast内で読み込むようにしました

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fa3995f
cssで読み込むようにしました

hasError?: boolean;
};
} & (
| { variant: Variant['information']; hasInfoIcon: boolean }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(他の箇所での実例がまだなさそう?だけど、) 表示、非表示系のbooleanはhide*, show* or display* にしようかと思っているのですがどでしょう。あと以下の前提だと、表示がデフォルトでもよさそうですが、その辺仕様確認したいです〜。

variant="information"の時は非表示できます

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

あとも一点、「informationのときにだけアイコン消せる」仕様の重要度や意図確認しておきたいです!重要度が高ければこのままコードでも担保するでよしで、あくまでガイドレベルであればvariant関わらず利用時に指定するでもいいかもしれないです。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

f8dc16d
修正しました!

variant={hasError ? 'danger' : 'outlined'}
onClick={() => setMessage('Toast Content')}
variant={variant === "error" ? 'danger' : 'outlined'}
onClick={() => setMessage(_message || 'Toast Content')}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

今更で恐縮なのですが、Storyのテキストをより実態に合わせた日本語にしていこうプロジェクト #162 がありまして、程よいタイミングで変えていきたいデス!Figmaの例に合わせても良い気がしてます。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

8aa0ceb
修正しました!

ref={transitionElementRef}
>
<div
className={`${BLOCK_NAME}--content ${errorContentClassName}`}
className={`${BLOCK_NAME}-content ${BLOCK_NAME}-content--${variant}`}
tabIndex={0}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Q: ここをフォーカスする機能はなくしてもいいかなっていう話があった気がしますが、今回含めず別途にしますかな

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

この状態で出すのも微妙な気がするのでこのPRで修正しちゃいます:pray:
#482 (comment)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

5bc833c
focus外しました!

Copy link
Contributor

@itsminadesu itsminadesu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💬

packages/spindle-ui/src/Toast/Toast.css Show resolved Hide resolved
packages/spindle-ui/src/Toast/Toast.css Outdated Show resolved Hide resolved
packages/spindle-ui/src/Toast/Toast.css Outdated Show resolved Hide resolved
packages/spindle-ui/src/Toast/Toast.css Outdated Show resolved Hide resolved
packages/spindle-ui/src/Toast/Toast.css Outdated Show resolved Hide resolved
packages/spindle-ui/src/Toast/Toast.css Outdated Show resolved Hide resolved
packages/spindle-ui/src/Toast/Toast.css Show resolved Hide resolved
packages/spindle-ui/src/Toast/Toast.css Show resolved Hide resolved
@keiya01
Copy link
Contributor Author

keiya01 commented Jul 21, 2022

position=bottomが動いてなかったので修正しました:pray:
b9f0da9

@keiya01
Copy link
Contributor Author

keiya01 commented Jul 21, 2022

203110f
iconについての説明をdocsに追記しました

itsminadesu
itsminadesu approved these changes Jul 21, 2022

type Props = {
children?: React.ReactNode;
id?: string;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Q: こりは何用だったけっかな

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

b6dd283
消し忘れでした:pray:

[K in Position]?: number;
};

type Variant = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

今の使い方だとUnionでも行けそうな気もするけど、なにか理由あったっけかな。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

981e0f1
修正しました!

Copy link
Contributor

@takami-shunsuke takami-shunsuke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTMです

@herablog
Copy link
Member

おっ、testコケが

z-index: -1;
.spui-Toast-contentText {
font-family: inherit;
font-size: 14px;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Q: ここの絶対値は意図した記述ですかな

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

43340ea
修正しました:pray:

@keiya01
Copy link
Contributor Author

keiya01 commented Jul 25, 2022

デザインレビューいただいた部分含めて3つほどコミット追加しました

Copy link
Contributor

@takami-shunsuke takami-shunsuke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

挙動、ロジック問題なさそうです!
IMOで細かいところだけ挙げました(前回レビュー漏れですみません)🙏

packages/spindle-ui/src/Toast/Toast.css Outdated Show resolved Hide resolved
packages/spindle-ui/src/Toast/Toast.tsx Outdated Show resolved Hide resolved
packages/spindle-ui/src/Toast/Toast.tsx Outdated Show resolved Hide resolved
Copy link
Contributor

@takami-shunsuke takami-shunsuke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

エンジニアを褒めるネコ:LGTM

@keiya01
Copy link
Contributor Author

keiya01 commented Aug 1, 2022

errorのスタイルだけ微修正しました
style: fix error style

@herablog
Copy link
Member

herablog commented Aug 1, 2022

Formatが必要かも! (testコケ太郎)

box-sizing: border-box;
color: var(--color-text-accent-primary);
cursor: default;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

これは前からだたけど...default指定しないと問題ありでしたっけかな

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

これは、、おそらく不要なやつです、、

@keiya01
Copy link
Contributor Author

keiya01 commented Aug 1, 2022

storybookでz-indexが効いていなかったので修正しました。合わせて説明も追記しました
test: fix storybook z-index

Copy link
Member

@herablog herablog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

エンジニアを褒めるネコ:おすしどぞ

@keiya01 keiya01 force-pushed the feat/update-toast branch 3 times, most recently from 23589bd to d1dd07a Compare August 18, 2022 03:18
BREAKING CHANGE: it changes some behaivior and adds new props
@keiya01 keiya01 merged commit 1500a3d into main Aug 18, 2022
@keiya01 keiya01 deleted the feat/update-toast branch August 18, 2022 05:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants