-
Notifications
You must be signed in to change notification settings - Fork 0
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/modal #54
Feat/modal #54
Conversation
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.
いくつか気になったところ書きました🙏
src/components/UI/ConfirmDialog.vue
Outdated
<base-button | ||
type="secondary" | ||
icon="mdi:arrow-left" | ||
@click="() => emit('close')" |
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.
Reactじゃないのでこれでよさそうです
@click="() => emit('close')" | |
@click="emit('close')" |
src/components/UI/ConfirmDialog.vue
Outdated
} | ||
|
||
.container { | ||
margin: 1rem 1.5rem; |
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.
paddingにしないとモーダルの中でもタイトルの少し上をクリックすると閉じちゃいそうです
margin: 1rem 1.5rem; | |
padding: 1rem 1.5rem; |
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.
左右はFigmaの通り1remにしたら2行に収まりそうです
src/pages/Index.vue
Outdated
<confirm-modal /> | ||
|
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.
消し忘れですかね
src/pages/Index.vue
Outdated
@@ -5,6 +5,8 @@ import PageContainer from '/@/components/Layout/PageContainer.vue' | |||
</script> | |||
|
|||
<template> | |||
<confirm-modal /> |
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.
例示していたここらへんをcomposablesとしてまとめるのがよさそうです?
const confirmDialogRef = ref()
const open = () => {
confirmDialogRef.value?.open()
}
const close = () => {
confirmDialogRef.value?.close()
}
src/components/UI/ConfirmDialog.vue
Outdated
@@ -0,0 +1,91 @@ | |||
<script lang="ts" setup> |
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.
コンポーネント名、ConfirmDialog
じゃなくてConfirmModal
の方がよさそうです(ちょっと調べてみた感じ、多分Dialogだと8行目でshowModal()
じゃなくてshow()
にしたときみたいな挙動になりそうです)
src/components/UI/ConfirmDialog.vue
Outdated
const dialogRef = ref<HTMLDialogElement>() | ||
|
||
const open = () => { | ||
dialogRef.value?.showModal() |
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.
オプショナルチェーン使うか18行目みたいに早期returnするかで統一したい気がするんですけど何か違いってありますか?
src/components/UI/ConfirmDialog.vue
Outdated
<h1 :class="$style.header">コンテストの削除</h1> | ||
<p :class="$style.body"> | ||
コンテンストと、コンテストに含まれるチームをすべて削除します。この操作は取り消せません。 | ||
</p> | ||
<div :class="$style.buttonContent"> | ||
<base-button | ||
type="secondary" | ||
icon="mdi:arrow-left" | ||
@click="() => emit('close')" | ||
>Back</base-button | ||
> | ||
<base-button | ||
type="warning" | ||
icon="mdi:close" | ||
@click="() => emit('remove')" | ||
>Remove</base-button | ||
> |
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.
コンテスト以外でも使うと思うので、いい感じにpropsを渡すようにしたいです
削除にしかこのコンポーネントを使わないかどうかでpropsの種類が変わってきそう
src/components/UI/ConfirmDialog.vue
Outdated
type="warning" | ||
icon="mdi:close" | ||
@click="() => emit('remove')" | ||
>Remove</base-button |
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.
多分この場合、remove
じゃなくてdelete
の方が適切な気がします(チームからメンバーを削除とかならメンバー自体は存在しているのでremoveだと思いますが、コンテストは完全に消去してしまうのでdeleteだと思います)
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点だけ追加で🙏
src/components/UI/ConfirmModal.vue
Outdated
<base-button | ||
type="secondary" | ||
icon="mdi:arrow-left" | ||
@click="emit('close')" | ||
>Back</base-button | ||
> |
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.
今更で申し訳ないんですけど、モーダルにBackってボタンあるのちょっと違和感ある気がします(実際には閉じるだけだけどページごと戻っちゃう気もしちゃいそう?)
Cancelにしてアイコンちょっと変えたりするといいかもと思いましたがどうでしょう👀
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.
適当なアイコン見つけるの難しそうであれば変更前の状態に戻しておいてもらえればそれで一旦approveします
> | ||
<base-button type="warning" icon="mdi:close" @click="emit('remove')" | ||
>Delete</base-button | ||
>Cancel</base-button |
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.
ここはDeleteのままだと思います
src/components/UI/ConfirmModal.vue
Outdated
@@ -52,10 +52,10 @@ const emit = defineEmits<{ | |||
type="secondary" | |||
icon="mdi:arrow-left" | |||
@click="emit('close')" | |||
>Back</base-button | |||
>Close</base-button | |||
> | |||
<base-button type="warning" icon="mdi:close" @click="emit('remove')" |
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.
remove=>deleteしたときにemitの値も変え忘れてそうです
src/components/UI/ConfirmModal.vue
Outdated
@@ -52,10 +52,10 @@ const emit = defineEmits<{ | |||
type="secondary" | |||
icon="mdi:arrow-left" | |||
@click="emit('close')" | |||
>Back</base-button | |||
>Close</base-button |
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.
ここなるボタンでCloseってあんまり見ない気がします、ここを「Cancel」にするという意図でした(アイコンも変えてほしいです)
コミットメッセージとやっていることが全然違ってしまって申し訳ないです。 元々、Delete のアイコンは✗マークだったんですが、Cancel と アイコンがかぶるので、ゴミ箱マークにしました。 |
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.
よさそうです!
close ConfirmModalの実装 #28
下のように、Index.vueを変更すると動作確認ができます。
Dialogのオープンとクローズを コンポーネントに持たせたところが悩んでます。