-
Notifications
You must be signed in to change notification settings - Fork 0
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
[4주차 기본/심화과제] ☀️승경씨의 날씨 예보☀️ #9
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
수고했어요오~~~ 몸조리 잘해야해!!!!!
"react": "^18.2.0", | ||
"react-dom": "^18.2.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
으이잉??? react-router-dom이랑 styled-components 어디 갔지..?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
오 그러게! 신기하다👀
<div> | ||
<Header /> | ||
<SearchInput /> | ||
<Outlet /> | ||
</div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
혹시 여기 div 태그로 감싸져있는 이유가 뭔가요옹
</StPeriodOption> | ||
|
||
<input placeholder="영어로 도시명 ex) seoul " ref={inputRef} /> | ||
<button type="submit">날씨 검색</button> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
어차피 눌렀을 때 실제 form 을 submit 하는게 아니고 추가적인 로직들을 수행하도록 되어있는 거니까!
type='button'으로 설정해두면 e.preventDefault를 할 필요도 없을 것 같아!!
사실 둘 중 뭐가 나은지는 모르겠는데...그런 방법도 있다! 는거죵~
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
하 형근아 혹시 녹음으로 코리했어?
const StErrorMsg = styled.h2` | ||
margin-left: 3rem; | ||
font-size: 3rem; | ||
`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
오옹 이거어는 이렇게 스타일을 지정해준 이유가 있나요??
h2를 쓰고 거기에 마진과 사이즈를 재조정...특이한 스타일링이라 그냥 궁금해서!
} = props; | ||
let [month, date]: [string, string] = ["", ""]; | ||
if (dt_txt) { | ||
[month, date] = dt_txt.slice(5, 10).split("-"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이거 짱 맘에 들어
}, | ||
isDaily, | ||
} = props; | ||
let [month, date]: [string, string] = ["", ""]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
요오기도 타입이 string이지만 보여지는 값은 숫자니까..! 이왕이면 요기 타입을 number로 지정하면 다른 이상한 문자열이 들어오는 경우를 방지할 수 있지 않을까! 그렇게 해두고 나중에 실제 값이 사용될 때 string으로 형변환을 해주면 되니까!
타스를 쓰니까 이왕이면 좀 더 좁고 엄격한(narrow) 타입을 사용해보면 좋을 것 같아용
type as string, | ||
area as string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
오잉 요기는 커스텀 훅 만드는 과정에서 지정해줬으니 여기서까지 타입 단언을 하지 않아도 괜찮지 않을까?
요기서 타입 단언 해준 이유가 궁금쓰합니당~~
<StWrapper> | ||
<WeatherCard | ||
isDaily={true} | ||
weatherCardInfo={detailWeatherInfo as WeatherInfoToRender} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
요기도! 타입 단언을 통해서 타입을 다시 명시해주는 이유가 궁금합니당~~
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
저도 궁금해요 👀👀👀
<div></div> | ||
<img /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
요오기는 이왕이면 어떤 역할을 하는지 클래스나 아이디로라도 적어주면 좋을 것 같아용
const client = axios.create({ | ||
baseURL: import.meta.env.VITE_APP_IP, | ||
headers: { | ||
"Content-type": "application/json", | ||
}, | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
axios 인스턴스 생성한거 조아요~
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
수고했어요오~~~ 몸조리 잘해야해!!!!!
"react": "^18.2.0", | ||
"react-dom": "^18.2.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
오 그러게! 신기하다👀
<BrowserRouter> | ||
<Routes> | ||
<Route path="/" element={<WeatherPage />}> | ||
<Route path="/:type/:area" element={<WeatherSection />} /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이렇게 한 번에 라우터 설정할 수 있었구나! 나는 더 어렵게 생각해서 라우팅 설정에서 시간 많이 썼었는데 배워가요!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
역쉬 성경이 므찌다 므찌당!!!!
타스 시작 전에 봤으면 하나도 몰랐을텐데
고거 조금 했다고 엄청 흥미롭다!!!!
코드 잘 보고 갔습니다!!
질문 단 것도 답변 해주세요!!
수고해써 쪽쪽
|
||
function App() { | ||
const [count, setCount] = useState(0); | ||
// const { weatherInfo } = useGetWeatherData("Seoul"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
주석아 내가 한 번 사라져볼게 얍!
<BrowserRouter> | ||
<Routes> | ||
<Route path="/" element={<WeatherPage />}> | ||
<Route path="/:type/:area" element={<WeatherSection />} /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
나 요렇게 쓰고 싶던거 못 썼는데 성경이 코드 얌지게 보고 배워가야지 ✨✨✨✨
|
||
const SearchInput = () => { | ||
const navigate = useNavigate(); | ||
const inputRef = useRef<HTMLInputElement>(null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
타스로햇고나...!!
const handleNavigate = (e: React.FormEvent<HTMLFormElement>) => { | ||
e.preventDefault(); | ||
const area = inputRef.current?.value; | ||
const type = isDailyInfo ? "day" : "week"; | ||
console.log(area, type); | ||
navigate(`/${type}/${area}`); | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
아 깔끔해 내가 이 코드를 못 맹글어가지고....
</StPeriodOption> | ||
|
||
<input placeholder="영어로 도시명 ex) seoul " ref={inputRef} /> | ||
<button type="submit">날씨 검색</button> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
하 형근아 혹시 녹음으로 코리했어?
<StWrapper> | ||
<WeatherCard | ||
isDaily={true} | ||
weatherCardInfo={detailWeatherInfo as WeatherInfoToRender} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
저도 궁금해요 👀👀👀
const LoadingSection = (props: LoadingSectionProps) => { | ||
const { isDaily } = props; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
나나 궁금한거
const LoadingSection = (props: LoadingSectionProps) => { | |
const { isDaily } = props; | |
const LoadingSection = ({ isDaily }: LoadingSectionProps) => { |
이렇게 적지 않는 이유는 무엇인가요?????
@@ -0,0 +1,14 @@ | |||
import { keyframes } from "styled-components"; | |||
|
|||
export const loading = keyframes` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
요걸 따로 뺴줬구나...!! 조은데?
@@ -0,0 +1,68 @@ | |||
export const WEATHER_TYPE = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
왜 두개이죠?!?!?!
const apiAddress = | ||
type === "day" | ||
? `/weather?q=${area}&appid=${ | ||
import.meta.env.VITE_APP_WEATHER | ||
}&units=metric` | ||
: `/forecast?q=${area}&appid=${ | ||
import.meta.env.VITE_APP_WEATHER | ||
}&units=metric`; | ||
console.log(type, area); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
제 바이블로 할게요.
✨ 구현 기능 명세
✅
기상 카드
✅
일간 / 주간 + 지역(영어)검색
✅
Outlet + Route
🌈 심화과제
✅
스켈레톤 UI
✅
커스텀훅으로 데이터를 받아옵시다!
🌼 PR Point
🥺 소요 시간, 어려웠던 점
8h
isArray
사용해서 주간 날씨 정보를 가져온 경우를 잡을 수 있도록 처리했어요.🌈 구현 결과물
2023-05-13.12.04.05.mov