-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
220 additions
and
196 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
113 changes: 54 additions & 59 deletions
113
weatherfit_refactoring/src/Components/Molecules/FeedSearch.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,67 +1,62 @@ | ||
'use client' | ||
|
||
import IconStore, { IconStyle } from "../Atoms/Icon/IconStore"; | ||
import InputStore, { InputStyle } from "../Atoms/Input/InputStore"; | ||
import ButtonStore, { ButtonStyle } from "../Atoms/Button/ButtonStore"; | ||
import { ChangeEventHandler, useEffect, useState } from "react"; | ||
import IconStore, { IconStyle } from '../Atoms/Icon/IconStore' | ||
import InputStore, { InputStyle } from '../Atoms/Input/InputStore' | ||
import ButtonStore, { ButtonStyle } from '../Atoms/Button/ButtonStore' | ||
import { ChangeEventHandler, useEffect, useState } from 'react' | ||
|
||
export default function FeedSearch() { | ||
const searchCancle = () => {} | ||
const [hashValue, setHval] = useState<string>(""); | ||
const searchCancle = () => { | ||
setHval(""); | ||
} | ||
|
||
const searchHashTag:ChangeEventHandler<HTMLInputElement> = (e:React.ChangeEvent<HTMLInputElement>) => { | ||
console.log("검색할 내용", e.target.value); | ||
setHval(e.target.value); | ||
} | ||
|
||
useEffect(()=>{ | ||
|
||
console.log("검색할려고 하는 태그", hashValue); | ||
hashToArray(); | ||
const [hashValue, setHval] = useState<string>('') | ||
|
||
},[hashValue]); | ||
|
||
const hashToArray = () => { | ||
const searchHashtagData:string[] = hashValue.split('#').filter(Boolean); | ||
console.log('해시태그 검색 배열', searchHashtagData); | ||
|
||
let url = "https://www.jerneithe.site/board/search?categories=" | ||
|
||
if(searchHashtagData.length != 0) { | ||
for(let i=0 ; i<searchHashtagData.length ; i++) { | ||
url += searchHashtagData[i]; | ||
} | ||
} | ||
|
||
console.log("검색 url", url); | ||
const searchCancle = () => { | ||
setHval('') | ||
} | ||
|
||
const searchHashTag: ChangeEventHandler<HTMLInputElement> = ( | ||
e: React.ChangeEvent<HTMLInputElement>, | ||
) => { | ||
console.log('검색할 내용', e.target.value) | ||
setHval(e.target.value) | ||
} | ||
|
||
useEffect(() => { | ||
console.log('검색할려고 하는 태그', hashValue) | ||
hashToArray() | ||
}, [hashValue]) | ||
|
||
const hashToArray = () => { | ||
const searchHashtagData: string[] = hashValue.split('#').filter(Boolean) | ||
console.log('해시태그 검색 배열', searchHashtagData) | ||
|
||
let url = 'https://www.jerneithe.site/board/search?categories=' | ||
|
||
if (searchHashtagData.length != 0) { | ||
for (let i = 0; i < searchHashtagData.length; i++) { | ||
url += searchHashtagData[i] | ||
} | ||
} | ||
|
||
|
||
|
||
return( | ||
<div className=" flex py-[10px] px-[10px]"> | ||
<div className="flex border rounded-[9px] mx-1"> | ||
<InputStore | ||
inputStyle={InputStyle.INPUT_SEARCH} | ||
placeholderContents="#해시태그를 입력하세요" | ||
style="font-gmarketsans font-thin outline-none text-[14px] w-[65vw] h-[38px] mx-1" | ||
value={hashValue} | ||
onChageFunction={searchHashTag} | ||
/> | ||
<IconStore | ||
iconStyle={IconStyle.SEARCH} | ||
size={16} | ||
style="mr-[10px]"/> | ||
</div> | ||
<ButtonStore | ||
buttonStyle={ButtonStyle.CANCEL_BTN} | ||
style="font-NanumSquareRound text-gray-500 text-[16px] w-[70px]" | ||
onClickFunction={searchCancle}> | ||
취소 | ||
</ButtonStore> | ||
</div> | ||
) | ||
console.log('검색 url', url) | ||
} | ||
|
||
return ( | ||
<div className=" flex py-[10px] px-[10px]"> | ||
<div className="flex border rounded-[9px] mx-1"> | ||
<InputStore | ||
inputStyle={InputStyle.INPUT_SEARCH} | ||
placeholderContents="#해시태그를 입력하세요" | ||
style="font-gmarketsans font-thin outline-none text-[14px] w-[65vw] h-[38px] mx-1" | ||
value={hashValue} | ||
onChageFunction={searchHashTag} | ||
/> | ||
<IconStore iconStyle={IconStyle.SEARCH} size={16} style="mr-[10px]" /> | ||
</div> | ||
<ButtonStore | ||
buttonStyle={ButtonStyle.CANCEL_BTN} | ||
style="font-NanumSquareRound text-gray-500 text-[16px] w-[70px]" | ||
onClickFunction={searchCancle}> | ||
취소 | ||
</ButtonStore> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.