Skip to content

Commit

Permalink
[PDW-54] fix: 자원 예약 카드 클릭시 상세 예약페이지로 넘어가게 설정
Browse files Browse the repository at this point in the history
  • Loading branch information
chayoosang committed Oct 11, 2023
1 parent 7d5bdfe commit 2e0328f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
11 changes: 10 additions & 1 deletion src/components/resourceInfo/ResourceInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import styled from "styled-components"
import Example from '../../assets/images/example.png'
import Capsule from "components/capsule/Capsule";
import { ResourceCard, CardText, DetailContainer, ResourceCardImage, InfoContainer, DescriptionContainer, OfficeContentText, ResourceTitle } from "components/card/Card";
import { useNavigate } from "react-router-dom";

// 자원명 컨테이너
const ResourceTitleContainer = styled.div`
Expand All @@ -12,9 +13,17 @@ const ResourceTitleContainer = styled.div`
`





function ResourceInfo(props) {
const moveToDetail = () => {
window.location.href = "/resourceBooking/"+props.resourceId
}


return (
<ResourceCard onClick={props.click}>
<ResourceCard onClick={props.detail===true ? moveToDetail : {}}>
<DetailContainer>
<ResourceCardImage src={Example} />

Expand Down
4 changes: 3 additions & 1 deletion src/pages/booking/selectResource/SelectResource.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import React, { useState, useEffect } from "react";
import styled from "styled-components";
import ResourceInfo from "components/resourceInfo/ResourceInfo";
import { ResourcesAxios } from "api/AxiosApi";
import { useNavigate } from "react-router-dom";


export const SearchTitleContainer = styled.div`
Expand Down Expand Up @@ -61,6 +62,7 @@ export const SearchDateInput = styled.input`
`

function SelectResource(props) {
const navigate = useNavigate();

const [resourceList, setResourceList] = useState([]);
const [resourceName, setResourceName] = useState("");
Expand Down Expand Up @@ -118,7 +120,7 @@ function SelectResource(props) {

<WhiteContainer>
<div className="cardList">
{resourceList.length === 0 ? <label>예약 가능한 자원이 없습니다.</label> : resourceList.map((resource) => <ResourceInfo key={resource.resourceId} name={resource.name} image={resource.imgUrl} category={resource.category} description={resource.description} />)}
{resourceList.length === 0 ? <label>예약 가능한 자원이 없습니다.</label> : resourceList.map((resource, index) => <ResourceInfo key={resource.index} detail={true} resourceId={resource.resourceId} name={resource.name} image={resource.imgUrl} category={resource.category} description={resource.description} />)}
</div>
</WhiteContainer>
</RightContainer>
Expand Down

0 comments on commit 2e0328f

Please sign in to comment.