Skip to content

Commit

Permalink
Merge pull request #188 from Step3-kakao-tech-campus/feat/#171
Browse files Browse the repository at this point in the history
GNB 개선, map 스켈레톤 삭제, lighthouse 성능개선 추가
  • Loading branch information
hjiwon authored Nov 10, 2023
2 parents fcd6f80 + f97fc65 commit 8f6fff0
Show file tree
Hide file tree
Showing 11 changed files with 38 additions and 39 deletions.
4 changes: 4 additions & 0 deletions src/commons/components/LogoButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ const LogoButton = ({ imageClassName, logoClassName }: LogoButtonProps) => {
className={`w-8 ${imageClassName}`}
src="/assets/images/paw.png"
alt="애니모리 로고"
style={{
width: '32px',
height: '32px',
}}
/>
<h1 className={`text-brand-color font-bold text-2xl ${logoClassName}`}>
애니모리
Expand Down
2 changes: 2 additions & 0 deletions src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@ normal, bold만 적용시켜놨습니다.
src: url(../public/assets/fonts/Pretendard-Regular.woff) format('woff');
font-weight: normal;
font-style: normal;
font-display: swap;
}

@font-face {
font-family: 'Pretendard';
src: url(../public/assets/fonts/Pretendard-Bold.woff) format('woff');
font-weight: bold;
font-style: normal;
font-display: swap;
}

/* 로더 */
Expand Down
15 changes: 13 additions & 2 deletions src/layouts/VGNB.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,15 @@ const VGNB = (props: VGNBProps) => {
<div className="flex w-11/12 justify-between items-center">
<LogoButton />
<button className="text-3xl" onClick={handleToggleClick}>
<img className="w-8" src="/assets/images/menu.png" alt="메뉴" />
<img
className="w-8"
src="/assets/images/menu.png"
alt="메뉴"
style={{
width: '35px',
height: '28px',
}}
/>
</button>
</div>
</div>
Expand All @@ -39,27 +47,30 @@ const VGNB = (props: VGNBProps) => {
<UserToggleBox />
</div>
<ol className="flex flex-col justify-center w-full gap-4">
<li className="border-b pb-4">
<li className="border-b pb-4" onClick={handleToggleClick}>
<button onClick={handleCategoryButtonClick}>카테고리</button>
</li>
<li
className={`${
isProfilePage ? 'text-brand-color' : ''
} border-b pb-4`}
onClick={handleToggleClick}
>
<Link to="/profile">프로필 목록</Link>
</li>
<li
className={`${
isFindShelterPage ? 'text-brand-color' : ''
} border-b pb-4`}
onClick={handleToggleClick}
>
<Link to="/find-shelter">내 주변 보호소 찾기</Link>
</li>
<li
className={`${
isRegisterPage ? 'text-brand-color' : ''
} border-b pb-4`}
onClick={handleToggleClick}
>
<Link to="/register">등록하기</Link>
</li>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/home/components/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import VideoMuteIcon from './VideoMuteIcon';
import { HomeVideoSliderProps } from '../homeType';

const Home = () => {
const [muted, setMuted] = useState(true);
const [muted, setMuted] = useState(false);
const [opacity, setOpacity] = useState(0);
const [species, setSpecies] = useRecoilState<SpeciesType>(speciesState);
const [region, setRegion] = useRecoilState<RegionType>(regionState);
Expand Down
2 changes: 1 addition & 1 deletion src/pages/home/components/HomeVideo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ const HomeVideo = (props: HomeVideoProps) => {
<video
className="w-full h-full"
ref={videoPlayerRef}
muted={!muted}
muted={muted}
autoPlay={playing}
loop
playsInline
Expand Down
14 changes: 12 additions & 2 deletions src/pages/home/components/VideoMuteIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,24 @@ const VideoMuteIcon = (props: VideoMuteIconProps) => {
<img
src="/assets/images/speaker.svg"
alt="speaker"
style={{ opacity, transition: 'opacity 0.5s' }}
style={{
opacity,
transition: 'opacity 0.5s',
width: '100%',
height: '100%',
}}
/>
)}
{muted && (
<img
src="/assets/images/mute.svg"
alt="mute"
style={{ opacity, transition: 'opacity 0.5s' }}
style={{
opacity,
transition: 'opacity 0.5s',
width: '100%',
height: '100%',
}}
/>
)}
</div>
Expand Down
11 changes: 4 additions & 7 deletions src/pages/map/components/Map.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@
/* eslint-disable @typescript-eslint/no-unused-vars */
/* eslint-disable @typescript-eslint/no-use-before-define */
/* eslint-disable no-new */
import { useState, useEffect, useRef } from 'react';
import { useEffect, useRef } from 'react';
import MapList from './MapList';
import MapSkeleton from './MapSkeleton';
import useMap from '../useMap';

declare global {
Expand All @@ -20,9 +19,8 @@ declare global {

const Map = () => {
const mapRef = useRef<HTMLDivElement>(null);
const [loading, setLoading] = useState(true);
const { map, displayMarkerByInfo, searchedPlace, mutate, mutateData } =
useMap(mapRef, setLoading);
useMap(mapRef);
useEffect(() => {
mutate(searchedPlace);
}, [searchedPlace]);
Expand All @@ -43,9 +41,8 @@ const Map = () => {

return (
<div className="Map flex flex-col md:flex-row items-center justify-center gap-8">
<div ref={mapRef} className={`w-96 h-96 ${loading ? 'hidden' : ''}`} />
{loading && <MapSkeleton listSize={4} />}
<MapList searchedPlace={searchedPlace} map={map} loading={loading} />
<div ref={mapRef} className={`w-96 h-96`} />
<MapList searchedPlace={searchedPlace} map={map} />
</div>
);
};
Expand Down
6 changes: 0 additions & 6 deletions src/pages/map/components/MapList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@ import { SearchedPlace } from '../mapType';
const MapList = ({
searchedPlace,
map,
loading,
}: {
searchedPlace: SearchedPlace[];
// eslint-disable-next-line @typescript-eslint/no-explicit-any
map: any;
loading: boolean;
}) => {
const { kakao } = window;
const navigate = useNavigate();
Expand All @@ -31,10 +29,6 @@ const MapList = ({
return 0;
});

if (loading) {
return <></>;
}

return (
<div className="w-96">
{searchedPlace.map((place) => (
Expand Down
17 changes: 0 additions & 17 deletions src/pages/map/components/MapSkeleton.tsx

This file was deleted.

2 changes: 1 addition & 1 deletion src/pages/map/components/displayMarker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const displayMarker = async (map: any, addressInfo: SearchedPlace) => {

const DEFAULT_SHELTER_SRC = '/assets/images/racoon.png';
const ANYMORY_SHELTER_SRC = '/assets/images/dog.png';
const imageSize = new kakao.maps.Size(64, 69);
const imageSize = new kakao.maps.Size(64, 64);

const markerImageDefault = new kakao.maps.MarkerImage(
DEFAULT_SHELTER_SRC,
Expand Down
2 changes: 0 additions & 2 deletions src/pages/map/useMap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { SearchedPlace } from './mapType';

function useMap<T>(
containerRef: RefObject<T extends HTMLElement ? T : HTMLElement>,
setLoading: React.Dispatch<React.SetStateAction<boolean>>,
) {
const { kakao } = window;
const [map, setMap] = useState<any>();
Expand All @@ -30,7 +29,6 @@ function useMap<T>(
}).then((res) => res.json()),
{
onSuccess: (data) => {
setLoading(false);
if (data.success === false) {
throw new Error(data.error.message);
}
Expand Down

0 comments on commit 8f6fff0

Please sign in to comment.