diff --git a/frontend/.vscode/settings.json b/frontend/.vscode/settings.json index 8194859ba..0357d2c4e 100644 --- a/frontend/.vscode/settings.json +++ b/frontend/.vscode/settings.json @@ -12,5 +12,5 @@ "stylelint.config": null, "stylelint.validate": ["css", "scss", "typescript", "typescriptreact"], - "cSpell.words": ["JSESSION", "tanstack", "zustand"] + "cSpell.words": ["JSESSION", "tanstack", "webp", "zustand"] } diff --git a/frontend/.webpack/webpack.common.js b/frontend/.webpack/webpack.common.js index fc130e966..c1fece30c 100644 --- a/frontend/.webpack/webpack.common.js +++ b/frontend/.webpack/webpack.common.js @@ -24,7 +24,7 @@ module.exports = { sideEffects: true, }, { - test: /\.(jpg|jpeg|gif|png|ico)?$/, + test: /\.(jpg|jpeg|gif|png|ico|webp)?$/, type: 'asset', generator: { filename: 'images/[name][ext]', diff --git a/frontend/src/@types/global.d.ts b/frontend/src/@types/global.d.ts index cc723c203..a521b7a80 100644 --- a/frontend/src/@types/global.d.ts +++ b/frontend/src/@types/global.d.ts @@ -2,6 +2,7 @@ declare module '*.png'; declare module '*.woff2'; +declare module '*.webp'; declare module '*.svg' { import * as React from 'react'; diff --git a/frontend/src/assets/images/no-image.webp b/frontend/src/assets/images/no-image.webp new file mode 100644 index 000000000..ff4108e27 Binary files /dev/null and b/frontend/src/assets/images/no-image.webp differ diff --git a/frontend/src/components/@common/WaterMarkImage/WaterMarkImage.tsx b/frontend/src/components/@common/WaterMarkImage/WaterMarkImage.tsx index 817014518..4fab50d79 100644 --- a/frontend/src/components/@common/WaterMarkImage/WaterMarkImage.tsx +++ b/frontend/src/components/@common/WaterMarkImage/WaterMarkImage.tsx @@ -1,5 +1,6 @@ import { useState } from 'react'; import { styled, css } from 'styled-components'; +import useOnClickBlock from '~/hooks/useOnClickBlock'; import { BORDER_RADIUS, FONT_SIZE, paintSkeleton } from '~/styles/common'; import { getImgUrl } from '~/utils/image'; @@ -12,13 +13,14 @@ interface WaterMarkImageProps { function WaterMarkImage({ waterMark, imageUrl, type, sns }: WaterMarkImageProps) { const [isImageLoading, setIsImageLoading] = useState(true); + const register = useOnClickBlock({ + callback: e => { + e.stopPropagation(); - const onClickWaterMark = (e: React.MouseEvent) => { - e.stopPropagation(); - - if (sns === 'INSTAGRAM') window.open(`https://www.instagram.com/${waterMark.substring(1)}`, '_blank'); - if (sns === 'YOUTUBE') window.open(`https://www.youtube.com/${waterMark}`, '_blank'); - }; + if (sns === 'INSTAGRAM') window.open(`https://www.instagram.com/${waterMark.substring(1)}`, '_blank'); + if (sns === 'YOUTUBE') window.open(`https://www.youtube.com/${waterMark}`, '_blank'); + }, + }); return ( @@ -33,7 +35,7 @@ function WaterMarkImage({ waterMark, imageUrl, type, sns }: WaterMarkImageProps) /> {waterMark && ( -