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

[#159] Header 관련 로직 추가 #160

Merged
merged 14 commits into from
Jan 4, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
feat: 코드 스타일 업데이트
  • Loading branch information
halfmoon-mind committed Dec 28, 2023
commit 42fec54421883d7259d9642d23478607d79db5a5
Original file line number Diff line number Diff line change
@@ -3,7 +3,11 @@ import * as styles from './LineSearchBar.styles';
import searchicon from '@icons/icon/Search/BlueSearch.svg';
import cancelicon from '@icons/icon/SubscribeList/Cancel.svg';

const LineSearchBar = ({onSearch}:{onSearch : (searchText:string)=>void}) => {
const LineSearchBar = ({
onSearch,
}: {
onSearch: (searchText: string) => void;
}) => {
const [searchText, setSearchText] = useState('');

const handleOnKeyPress = (e: KeyboardEvent<HTMLInputElement>) => {
@@ -15,7 +19,7 @@ const LineSearchBar = ({onSearch}:{onSearch : (searchText:string)=>void}) => {
const handleClearSearch = () => {
setSearchText('');
};
const handleSearch = () =>{
const handleSearch = () => {
onSearch(searchText);
};

@@ -30,18 +34,23 @@ const LineSearchBar = ({onSearch}:{onSearch : (searchText:string)=>void}) => {
onChange={(e) => setSearchText(e.target.value)}
/>
<styles.Circle onClick={handleClearSearch}>
<styles.CancelImage src={cancelicon} width={18} height={18} alt={''} />
<styles.CancelImage
src={cancelicon}
width={18}
height={18}
alt={''}
/>
</styles.Circle>
<styles.GlassImage

<styles.GlassImage
src={searchicon}
width={24}
height={24}
alt={''}
onClick={handleSearch}/>
width={24}
height={24}
alt={''}
onClick={handleSearch}
/>
</styles.SearchBarStyles>
</styles.SearchBarBox>

);
};

61 changes: 32 additions & 29 deletions src/components/Home/NoticeFunSystemTab/NoticeFunSystemTab.tsx
Original file line number Diff line number Diff line change
@@ -5,50 +5,53 @@ import LineSearchBar from './LineSearchBar/LineSearchBar';
import CommunityList from '@/components/community/list/CommunityList';
import FunSystemList from '@/components/notice/FunSystemList';


const NoticeFunSystemTab = () => {


const [index, setIndex] = useState(0);
const [search, setSearch] = useState("");
const [search, setSearch] = useState('');

useEffect(()=>{
useEffect(() => {
window.location.reload;
}, [index, search]);

const handleSearch = (searchText : string) =>{
const handleSearch = (searchText: string) => {
setSearch(searchText);
}
};

const selectMenuHandler = (n: number) => {
setIndex(n);
};

return (
<>
<LineSearchBar onSearch = {handleSearch}/>
{search && <styles.TabContainer>
<styles.TabBox>
{["공지사항", "펀시스템","커뮤니티"].map((element, idx) => (
<styles.TabFontBox
key={idx}
isSelected={idx === index}
onClick={() => selectMenuHandler(idx)}>
{element}
</styles.TabFontBox>
))}
</styles.TabBox>
{index === 0 ? (
<NoticeList key={search} search = {search} category = "ALL"/>
) : index === 1 ?(
<FunSystemList key={search} search = {search} category = "ALL"/>
) : (
<CommunityList key={search} isButtonVisible = {false} search = {search}/>
)}
</styles.TabContainer>}

<LineSearchBar onSearch={handleSearch} />
{search && (
<styles.TabContainer>
<styles.TabBox>
{['공지사항', '펀시스템', '커뮤니티'].map((element, idx) => (
<styles.TabFontBox
key={idx}
isSelected={idx === index}
onClick={() => selectMenuHandler(idx)}
>
{element}
</styles.TabFontBox>
))}
</styles.TabBox>
{index === 0 ? (
<NoticeList key={search} search={search} category="ALL" />
) : index === 1 ? (
<FunSystemList key={search} search={search} category="ALL" />
) : (
<CommunityList
key={search}
isButtonVisible={false}
search={search}
/>
)}
</styles.TabContainer>
)}
</>
);
};

export default NoticeFunSystemTab;
export default NoticeFunSystemTab;