better hitbox for status emoji

This commit is contained in:
Henry Jameson 2019-09-08 21:18:05 +03:00
parent 7360a4d9ef
commit 9146bee7aa
3 changed files with 20 additions and 9 deletions

View file

@ -696,6 +696,22 @@ $status-margin: 0.75em;
line-height: 1.4em;
white-space: pre-wrap;
.emoji-container {
display: inline-block;
width: 32px;
height: 32px;
z-index: 1;
&:hover {
z-index: 2;
.emoji {
transform: scale(3);
z-index: 2;
}
}
}
img, video {
max-width: 100%;
max-height: 400px;
@ -707,12 +723,7 @@ $status-margin: 0.75em;
height: 32px;
transition: transform 200ms;
transform: scale(1);
z-index: 1;
&:hover {
transform: scale(3);
z-index: 2;
}
pointer-events: none;
}
}

View file

@ -194,7 +194,7 @@ export const addEmojis = (string, emojis) => {
return emojis.reduce((acc, emoji) => {
return acc.replace(
new RegExp(`:${emoji.shortcode}:`, 'g'),
`<img src='${emoji.url}' alt='${emoji.shortcode}' title='${emoji.shortcode}' class='emoji' />`
`<span class='emoji-container'><img src='${emoji.url}' alt='${emoji.shortcode}' title='${emoji.shortcode}' class='emoji' /></span>`
)
}, string)
}

View file

@ -323,9 +323,9 @@ describe('API Entities normalizer', () => {
describe('MastoAPI emoji adder', () => {
const emojis = makeMockEmojiMasto()
const imageHtml = '<img src="https://example.com/image.png" alt="image" title="image" class="emoji" />'
const imageHtml = '<span class="emoji-container"><img src="https://example.com/image.png" alt="image" title="image" class="emoji" /></span>'
.replace(/"/g, '\'')
const thinkHtml = '<img src="https://example.com/think.png" alt="thinking" title="thinking" class="emoji" />'
const thinkHtml = '<span class="emoji-container"><img src="https://example.com/think.png" alt="thinking" title="thinking" class="emoji" /></span>'
.replace(/"/g, '\'')
it('correctly replaces shortcodes in supplied string', () => {