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

✨ ToggleSwitchを実装 #26

Merged
merged 3 commits into from
Oct 5, 2022
Merged

✨ ToggleSwitchを実装 #26

merged 3 commits into from
Oct 5, 2022

Conversation

toshi-pono
Copy link
Member

やったこと

  • ToggleSwitchコンポーネントの実装

toggle

close #18

@toshi-pono toshi-pono self-assigned this Oct 2, 2022
<script lang="ts" setup>
const props = withDefaults(
defineProps<{
modelValue?: boolean
Copy link
Contributor

Choose a reason for hiding this comment

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

optionalにする必要がなさそうかなーと思ったのですが、modelValueを使わない場面って何か想定していますか?

Copy link
Member Author

Choose a reason for hiding this comment

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

formの中で使う場面もないので、optionalにする必要ないですね。修正しました:pray:

Copy link
Contributor

Choose a reason for hiding this comment

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

これに伴って、modelValueのdefault値も消しておいてほしいです🙏

<label :class="$style.container">
<input
type="checkbox"
:checked="props.modelValue"
Copy link
Contributor

Choose a reason for hiding this comment

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

checkedは現在の選択状態じゃなくて初期値を表すらしいので、checkedじゃなくてvalueの方がいい気がします(それとは別にcheckedをpropsで用意してもいいとは思います)(それとも何か別の意図がありますか?)

Copy link
Member Author

Choose a reason for hiding this comment

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

v-modelを使うように修正しました:pray:

Comment on lines 46 to 49
.input:disabled + & {
pointer-events: none;
cursor: not-allowed;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

手元で確認してみた感じ、ここ効いてるかちょっと怪しい感じがしたのでもう一度確認してみていただきたいです

Copy link
Member Author

Choose a reason for hiding this comment

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

効いてなかった & pointer-events: none;がいらなさそう?なので、修正しました:pray:

@toshi-pono toshi-pono requested a review from mehm8128 October 4, 2022 02:57
Copy link
Contributor

@sapphi-red sapphi-red left a comment

Choose a reason for hiding this comment

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

#26 (comment)
ここ以外はよさそうです 👍

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.

よさそうです!ありがとうございます

@toshi-pono toshi-pono merged commit 1696dcd into main Oct 5, 2022
@toshi-pono toshi-pono deleted the toshi00/toggle-switch branch October 5, 2022 09:30
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.

トグルスイッチコンポーネントの実装
4 participants