-
Notifications
You must be signed in to change notification settings - Fork 42
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
リアクションをホバーしたときに拡大して表示 #4434
base: master
Are you sure you want to change the base?
リアクションをホバーしたときに拡大して表示 #4434
Changes from 3 commits
c1c88b5
8d05380
acd6832
0101b00
ec87df5
e50a748
6bbdefe
7c3878d
dfe59a5
2544496
862f88f
5ee9bac
108c4c1
b5850d4
3a771c4
646c014
f19b322
5087384
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,8 @@ | |
:title="tooltip" | ||
:data-include-me="$boolAttr(includeMe)" | ||
@click="onClick" | ||
@mouseenter="onMouseEnter" | ||
@mouseleave="onMouseLeave" | ||
> | ||
<transition name="stamp-pressed" mode="out-in"> | ||
<a-stamp | ||
|
@@ -15,6 +17,11 @@ | |
</transition> | ||
<spin-number :value="stamp.sum" :class="$style.count" /> | ||
</div> | ||
<stamp-scaled-element | ||
:class="$style.scaleReaction" | ||
:show="isHovered && !isDetailShown" | ||
:stamp="stamp" | ||
/> | ||
</template> | ||
|
||
<script lang="ts" setup> | ||
|
@@ -24,9 +31,12 @@ import { ref, computed, watch, onMounted } from 'vue' | |
import { useStampsStore } from '/@/store/entities/stamps' | ||
import { useUsersStore } from '/@/store/entities/users' | ||
import type { MessageStampById } from '/@/lib/messageStampList' | ||
import StampScaledElement from './StampScaledElement.vue' | ||
import useHover from '/@/composables/dom/useHover' | ||
|
||
const props = defineProps<{ | ||
stamp: MessageStampById | ||
isDetailShown: boolean | ||
}>() | ||
|
||
const emit = defineEmits<{ | ||
|
@@ -85,6 +95,8 @@ watch( | |
isProgress.value = false | ||
} | ||
) | ||
|
||
const { isHovered, onMouseEnter, onMouseLeave } = useHover() | ||
</script> | ||
|
||
<style lang="scss" module> | ||
|
@@ -103,6 +115,7 @@ watch( | |
user-select: none; | ||
overflow: hidden; | ||
contain: content; | ||
position: relative; | ||
} | ||
|
||
.count { | ||
|
@@ -118,4 +131,18 @@ watch( | |
right: 4px; | ||
} | ||
} | ||
|
||
.scaleReaction { | ||
@include background-tertiary; | ||
display: flex; | ||
height: 3.5rem; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ここで高さが指定されていると思うんですが、これをしなくてもいいのかなと思いました 現状だと親要素の |
||
align-items: flex-start; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 高さを可変にすることを考えると、これは上下中央揃えにしたほうが見栄えが良さそうな気がします |
||
padding: 0.125rem 0.25rem; | ||
border-radius: 0.25rem; | ||
user-select: none; | ||
overflow: visible; | ||
contain: content; | ||
position: absolute; | ||
bottom: 105%; | ||
} | ||
</style> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<template> | ||
<div v-show="show" :class="$style.scaleReaction"> | ||
<transition name="scale-reaction"> | ||
<!-- sizeを46より大きくすると見切れる --> | ||
<a-stamp | ||
:key="stamp.id" | ||
:stamp-id="stamp.id" | ||
:size="46" | ||
:class="$style.stamp" | ||
without-title | ||
/> | ||
</transition> | ||
<stamp-detail-element :class="$style.detail" :stamp="stamp" /> | ||
</div> | ||
</template> | ||
|
||
<script lang="ts" setup> | ||
import AStamp from '/@/components/UI/AStamp.vue' | ||
import type { MessageStampById } from '/@/lib/messageStampList' | ||
import StampDetailElement from './StampDetailElement.vue' | ||
|
||
const props = defineProps<{ | ||
stamp: MessageStampById | ||
show: boolean | ||
}>() | ||
</script> | ||
|
||
<style lang="scss" module> | ||
.scaleReaction { | ||
@include color-ui-tertiary; | ||
@include background-primary; | ||
display: flex; | ||
border-radius: 4px; | ||
contain: none; | ||
flex-wrap: wrap; | ||
border: solid 2px $theme-ui-tertiary-default; | ||
} | ||
.stamp { | ||
margin: { | ||
right: 0.2rem; | ||
bottom: 0.2rem; | ||
} | ||
display: flex; | ||
} | ||
|
||
.detail { | ||
color: var(--specific-count-text); | ||
@include color-ui-primary; | ||
max-width: 500px; | ||
min-width: 0; | ||
overflow: hidden; | ||
overflow: clip; | ||
margin: { | ||
left: 6px; | ||
right: 4px; | ||
} | ||
} | ||
</style> |
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.
今の状態だと、↑の画像みたいにマウスホバー時のポップアップが 2 つ同時に出てしまうので
title
属性を消していいと思いますただ、これをしてしまうと a11y (アクセシビリティ) の観点から困ったことになる可能性もあるので、
aria-label
などの属性に切り替えるのを検討したほうがいいと思います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.
title
属性を消去してaria-label
属性に切り替えましたDiscordを参考にして
aria-label
の内容を定めたのでa11yの観点からも問題はないと思われます