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/modal #54

Merged
merged 11 commits into from
May 26, 2023
Merged

Feat/modal #54

merged 11 commits into from
May 26, 2023

Conversation

tesso57
Copy link
Member

@tesso57 tesso57 commented Jan 3, 2023

  • close ConfirmModalの実装 #28

  • 下のように、Index.vueを変更すると動作確認ができます。

  • Dialogのオープンとクローズを コンポーネントに持たせたところが悩んでます。

    • いい感じに分離させたいかも
<script lang="ts" setup>
import ContentHeader from '/@/components/Layout/ContentHeader.vue'
import PageInfoPanels from '/@/components/Index/PageInfoPanels.vue'
import PageContainer from '/@/components/Layout/PageContainer.vue'
import ConfirmModal from '../components/UI/ConfirmModal.vue'
import useModal from '../components/UI/composables/useModal'

const { modalRef, open, close } = useModal()
</script>

<template>
  <button @click="open">HELLO</button>
  <confirm-modal
    ref="modalRef"
    title="コンテストの削除"
    body="コンテンストと、コンテストに含まれるチームをすべて削除します。この操作は取り消せません。"
    @close="close"
  />
  <page-container>
    <content-header
      icon-name="mdi:apps"
      :header-texts="[{ title: 'Top', url: '/' }]"
      detail="ポートフォリオの設定を変更します"
      :class="$style.header"
    />
    <page-info-panels />
  </page-container>
</template>

<style lang="scss" module>
.header {
  margin: 4rem 0 2rem;
}
</style>

Copy link
Contributor

@mehm8128 mehm8128 left a comment

Choose a reason for hiding this comment

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

いくつか気になったところ書きました🙏

<base-button
type="secondary"
icon="mdi:arrow-left"
@click="() => emit('close')"
Copy link
Contributor

Choose a reason for hiding this comment

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

Reactじゃないのでこれでよさそうです

Suggested change
@click="() => emit('close')"
@click="emit('close')"

}

.container {
margin: 1rem 1.5rem;
Copy link
Contributor

Choose a reason for hiding this comment

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

paddingにしないとモーダルの中でもタイトルの少し上をクリックすると閉じちゃいそうです

Suggested change
margin: 1rem 1.5rem;
padding: 1rem 1.5rem;

Copy link
Contributor

Choose a reason for hiding this comment

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

左右はFigmaの通り1remにしたら2行に収まりそうです

Comment on lines 8 to 9
<confirm-modal />

Copy link
Contributor

Choose a reason for hiding this comment

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

消し忘れですかね

@@ -5,6 +5,8 @@ import PageContainer from '/@/components/Layout/PageContainer.vue'
</script>

<template>
<confirm-modal />
Copy link
Contributor

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()
}

@@ -0,0 +1,91 @@
<script lang="ts" setup>
Copy link
Contributor

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()にしたときみたいな挙動になりそうです)

const dialogRef = ref<HTMLDialogElement>()

const open = () => {
dialogRef.value?.showModal()
Copy link
Contributor

Choose a reason for hiding this comment

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

オプショナルチェーン使うか18行目みたいに早期returnするかで統一したい気がするんですけど何か違いってありますか?

Comment on lines 38 to 54
<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
>
Copy link
Contributor

Choose a reason for hiding this comment

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

コンテスト以外でも使うと思うので、いい感じにpropsを渡すようにしたいです
削除にしかこのコンポーネントを使わないかどうかでpropsの種類が変わってきそう

type="warning"
icon="mdi:close"
@click="() => emit('remove')"
>Remove</base-button
Copy link
Contributor

Choose a reason for hiding this comment

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

多分この場合、removeじゃなくてdeleteの方が適切な気がします(チームからメンバーを削除とかならメンバー自体は存在しているのでremoveだと思いますが、コンテストは完全に消去してしまうのでdeleteだと思います)

@tesso57 tesso57 self-assigned this Mar 8, 2023
@tesso57 tesso57 requested a review from mehm8128 March 22, 2023 11:00
Copy link
Contributor

@mehm8128 mehm8128 left a comment

Choose a reason for hiding this comment

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

よさそうです!提案レベルなのですが1点だけ追加で🙏

Comment on lines 51 to 56
<base-button
type="secondary"
icon="mdi:arrow-left"
@click="emit('close')"
>Back</base-button
>
Copy link
Contributor

Choose a reason for hiding this comment

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

今更で申し訳ないんですけど、モーダルにBackってボタンあるのちょっと違和感ある気がします(実際には閉じるだけだけどページごと戻っちゃう気もしちゃいそう?)
Cancelにしてアイコンちょっと変えたりするといいかもと思いましたがどうでしょう👀

Copy link
Member Author

Choose a reason for hiding this comment

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

たしかに

Copy link
Contributor

@mehm8128 mehm8128 left a 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
Copy link
Contributor

Choose a reason for hiding this comment

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

ここはDeleteのままだと思います

@@ -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')"
Copy link
Contributor

Choose a reason for hiding this comment

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

remove=>deleteしたときにemitの値も変え忘れてそうです

@@ -52,10 +52,10 @@ const emit = defineEmits<{
type="secondary"
icon="mdi:arrow-left"
@click="emit('close')"
>Back</base-button
>Close</base-button
Copy link
Contributor

Choose a reason for hiding this comment

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

ここなるボタンでCloseってあんまり見ない気がします、ここを「Cancel」にするという意図でした(アイコンも変えてほしいです)

@tesso57
Copy link
Member Author

tesso57 commented May 23, 2023

コミットメッセージとやっていることが全然違ってしまって申し訳ないです。
ボタン周りの文言を修正しました。

元々、Delete のアイコンは✗マークだったんですが、Cancel と アイコンがかぶるので、ゴミ箱マークにしました。
Figmaの方も変えてあります。
https://www.figma.com/file/BVnhB2JyTjKsGKdnAJDksb/traPortfolio?type=design&node-id=2241-1418&t=eAw5yRiz5TU0JjQi-4

@tesso57 tesso57 requested a review from mehm8128 May 23, 2023 12:14
Copy link
Contributor

@mehm8128 mehm8128 left a comment

Choose a reason for hiding this comment

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

よさそうです!

@tesso57 tesso57 merged commit b18cf56 into main May 26, 2023
@tesso57 tesso57 deleted the feat/modal branch May 26, 2023 08:47
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.

ConfirmModalの実装
2 participants