Skip to content

Commit

Permalink
feat: 둘러보기 페이지에서 본인 아닌 팀만 보이도록 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
KimKyuHoi committed May 29, 2024
1 parent 60cc69d commit 561e898
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 20 deletions.
1 change: 1 addition & 0 deletions front/src/interfaces/GroupInterface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ export interface IGroupProps {
id: number;
name: string;
isPrivate: boolean;
isMember: boolean;
}

export interface ICreateGroupModalProps {
Expand Down
24 changes: 12 additions & 12 deletions front/src/pages/group/components/GroupLists.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@ import { IGroupProps } from '@interfaces/GroupInterface';

import styled from '@emotion/styled';

const MyGroupLists = [
{
id: 1,
name: '해달 파이팅',
isPrivate: false,
},
{
id: 2,
name: '해달 고고',
isPrivate: false,
},
];
// const MyGroupLists = [
// {
// id: 1,
// name: '해달 파이팅',
// isPrivate: false,
// },
// {
// id: 2,
// name: '해달 고고',
// isPrivate: false,
// },
// ];

const GroupContainer = styled.div`
padding: 20px;
Expand Down
51 changes: 43 additions & 8 deletions front/src/pages/search/components/SearchResult.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,26 @@ const InputResultLayout = styled.div`
padding: 0.5rem 1rem;
`;

const GroupType = styled.p`
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
margin: 5px 0 0;
font-size: 14px;
color: var(--color-white);
width: 60px;
height: 20px;
border-radius: 12px;
background-color: var(--color-red);
font-size: var(--size-xs);
`;

const GroupTypeLayout = styled.div`
display: flex;
flex-direction: column;
`;

const SearchResult = () => {
const { data, isPending, isError, error } = useGroups();

Expand All @@ -61,18 +81,33 @@ const SearchResult = () => {
return <InputResultLayout>검색 결과가 없습니다.</InputResultLayout>;
}

const filteredGroups = data.filter((group: IGroupProps) => !group.isMember);

const onClickNav = () => {};

return (
<InputResultLayout>
{data.map((group: IGroupProps) => (
<SearchResultLayout key={group.id}>
<Text size='var(--size-sm)' weight='700' color='var(--color-black)'>
{group.name}
</Text>
<PButton onClick={onClickNav}>참여하기</PButton>
</SearchResultLayout>
))}
{filteredGroups.length === 0 ? (
<Text size='var(--size-sm)' weight='700' color='var(--color-black)'>
조건에 맞는 검색 결과가 없습니다.
</Text>
) : (
filteredGroups.map((group: IGroupProps) => (
<SearchResultLayout key={group.id}>
<GroupTypeLayout>
<Text
size='var(--size-sm)'
weight='700'
color='var(--color-black)'
>
{group.name}
</Text>
<GroupType>{group.isPrivate ? 'Private' : 'Public'}</GroupType>
</GroupTypeLayout>
<PButton onClick={onClickNav}>참여하기</PButton>
</SearchResultLayout>
))
)}
</InputResultLayout>
);
};
Expand Down

0 comments on commit 561e898

Please sign in to comment.