Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 검색창 컴포넌트 생성 및 적용 #12

Merged
merged 2 commits into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/components/SearchBar/SearchBar.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import React from 'react';
import * as S from './SearchBar.style';
import magnifyingGlassIcon from '../../icons/icon-magnifying-glass.svg';

export default function SearchBar() {
return (
<S.SearchBar>
<S.SearchIcon>
<img src={magnifyingGlassIcon} alt='돋보기' />
</S.SearchIcon>
<S.SearchInput placeholder='명함을 검색해주세요' />
</S.SearchBar>
);
}
36 changes: 36 additions & 0 deletions src/components/SearchBar/SearchBar.style.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import styled from '@emotion/styled';

export const SearchBar = styled.div`
display: flex;
height: 36px;
margin-bottom: 16px;
padding: 10px 18px;
align-items: center;
flex-shrink: 0;
border-radius: 10px;
background: #efefef;
gap: 10px;
`;

export const SearchIcon = styled.div`
width: 10px;
height: 14px;
transform: rotate(-47.353deg);
flex-shrink: 0;
fill: var(--grey2, #949494);
`;

export const SearchInput = styled.input`
border: none;
outline: none;
background: transparent;
width: 100%;
color: var(--grey3, #555);
font-size: 9px;
line-height: 150%;
letter-spacing: -0.5px;

&::placeholder {
color: #999;
}
`;
1 change: 1 addition & 0 deletions src/components/SearchBar/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default as SearchBar } from './SearchBar';
1 change: 1 addition & 0 deletions src/components/index.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export { Header } from './Header';
export { TabBar } from './TabBar';
export { SearchBar } from './SearchBar';
9 changes: 2 additions & 7 deletions src/pages/AddCardPage/AddCardPage.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as S from './AddCardPage.style';
import { useState } from 'react';
import { Header, TabBar } from '../../components';
import { Header, TabBar, SearchBar } from '../../components';
import magnifyingGlassIcon from '../../icons/icon-magnifying-glass.svg';
import addCard from '../../icons/icon-add-card.svg';
import addCardDot from '../../icons/icon-add-card-dot.svg';
Expand All @@ -12,12 +12,7 @@ export default function AddCardPage() {
<>
<S.AddCardPage>
<Header />
<S.SearchBar>
<S.SearchIcon>
<img src={magnifyingGlassIcon} alt='돋보기' />
</S.SearchIcon>
<S.SearchInput placeholder='명함을 검색해주세요' />
</S.SearchBar>
<SearchBar />

<S.TitleContainer>
<S.Title>명함 추가하기</S.Title>
Expand Down
36 changes: 0 additions & 36 deletions src/pages/AddCardPage/AddCardPage.style.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,42 +4,6 @@ export const AddCardPage = styled.div`
padding: 20px;
`;

// 검색창
export const SearchBar = styled.div`
display: flex;
height: 36px;
margin-bottom: 16px;
padding: 10px 18px;
align-items: center;
flex-shrink: 0;
border-radius: 10px;
background: #efefef;
gap: 10px;
`;

export const SearchIcon = styled.div`
width: 10px;
height: 14px;
transform: rotate(-47.353deg);
flex-shrink: 0;
fill: var(--grey2, #949494);
`;

export const SearchInput = styled.input`
border: none;
outline: none;
background: transparent;
width: 100%;
color: var(--grey3, #555);
font-size: 9px;
line-height: 150%;
letter-spacing: -0.5px;

&::placeholder {
color: #999;
}
`;

// 타이틀
export const TitleContainer = styled.div`
display: flex;
Expand Down
11 changes: 3 additions & 8 deletions src/pages/ViewCardPage/ViewCardPage.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import * as S from './ViewCardPage.style';
import { Header, TabBar } from '../../components';
import magnifyingGlassIcon from '../../icons/icon-magnifying-glass.svg';
import { Header, TabBar, SearchBar } from '../../components';
import more from '../../icons/icon-more.svg';
import arrowRight from '../../icons/icon-arrow-right.svg';
import { act, useState } from 'react';
Expand All @@ -12,12 +11,8 @@ export default function ViewCardPage() {
<>
<S.ViewCardPage>
<Header />
<S.SearchBar>
<S.SearchIcon>
<img src={magnifyingGlassIcon} alt='돋보기' />
</S.SearchIcon>
<S.SearchInput placeholder='명함을 검색해주세요' />
</S.SearchBar>
<SearchBar />

{/* 그룹 설정 버튼 */}
<S.ButtonContainer>
<S.GroupBtnWrapper>
Expand Down
36 changes: 0 additions & 36 deletions src/pages/ViewCardPage/ViewCardPage.style.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,42 +4,6 @@ export const ViewCardPage = styled.div`
padding: 20px;
`;

// 검색창
export const SearchBar = styled.div`
display: flex;
height: 36px;
margin-bottom: 16px;
padding: 10px 18px;
align-items: center;
flex-shrink: 0;
border-radius: 10px;
background: #efefef;
gap: 10px;
`;

export const SearchIcon = styled.div`
width: 10px;
height: 14px;
transform: rotate(-47.353deg);
flex-shrink: 0;
fill: var(--grey2, #949494);
`;

export const SearchInput = styled.input`
border: none;
outline: none;
background: transparent;
width: 100%;
color: var(--grey3, #555);
font-size: 9px;
line-height: 150%;
letter-spacing: -0.5px;

&::placeholder {
color: #999;
}
`;

// 버튼
export const ButtonContainer = styled.div`
display: flex;
Expand Down