Skip to content

Commit b3c89ea

Browse files
authored
スマホ画面で、画像がダウンロードされている問題を解決 (#641)
# PRの概要 ## 具体的な変更内容 ## 影響範囲 ## 動作要件 ## 補足 ## レビューリクエストを出す前にチェック! - [ ] 改めてセルフレビューしたか - [ ] 手動での動作検証を行ったか - [ ] server の機能追加ならば、テストを書いたか - 理由: 書いた | server の機能追加ではない - [ ] 間違った使い方が存在するならば、それのドキュメントをコメントで書いたか - 理由: 書いた | 間違った使い方は存在しない - [ ] わかりやすいPRになっているか <!-- レビューリクエスト後は、Slackでもメンションしてお願いすることを推奨します。 -->
1 parent 2056ea8 commit b3c89ea

File tree

1 file changed

+9
-20
lines changed

1 file changed

+9
-20
lines changed

web/components/ImageFallback.tsx

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -13,26 +13,15 @@ export function ImageFallback({ width, height, url }: Props) {
1313
: url;
1414

1515
return (
16-
<object
17-
data={URL}
18-
type="image/webp"
19-
width={width} // there probably prevent style shaking
20-
height={height}
21-
style={{
22-
width,
23-
height,
24-
objectFit: "cover",
25-
borderRadius: "50%",
26-
pointerEvents: "none",
16+
<img
17+
src={URL}
18+
onError={(e) => {
19+
(e.target as HTMLImageElement).src = "/avatar.svg";
2720
}}
28-
>
29-
<img
30-
src="/avatar.svg"
31-
width={width}
32-
height={height}
33-
style={{ width, height }}
34-
alt=""
35-
/>
36-
</object>
21+
width={width}
22+
height={height}
23+
style={{ width, height, borderRadius: "50%" }}
24+
alt=""
25+
/>
3726
);
3827
}

0 commit comments

Comments
 (0)