投稿時間:2022-11-06 14:06:49 RSSフィード2022-11-06 14:00 分まとめ(7件)
カテゴリー等 | サイト名等 | 記事タイトル・トレンドワード等 | リンクURL | 頻出ワード・要約等/検索ボリューム | 登録日 |
---|---|---|---|---|---|
python | Pythonタグが付けられた新着投稿 - Qiita | [python] pandas 条件によるフィルタリング | https://qiita.com/junzai/items/3a96796349f145d67877 | pandas | 2022-11-06 13:43:22 |
python | Pythonタグが付けられた新着投稿 - Qiita | Pyironの導入 | https://qiita.com/pinkscorpion/items/e2eae938e69fbf144f58 | pyiron | 2022-11-06 13:30:43 |
js | JavaScriptタグが付けられた新着投稿 - Qiita | 分割代入で配列やオブジェクトを簡単に取得! | https://qiita.com/Nkot117/items/5c724bc44dda066ff070 | 配列 | 2022-11-06 13:53:45 |
js | JavaScriptタグが付けられた新着投稿 - Qiita | 【MapLibre GL JS】flyToで目的地までジャンプする | https://qiita.com/asahina820/items/b8436b53b2bbe029918b | daymapchallenge | 2022-11-06 13:31:21 |
Ruby | Railsタグが付けられた新着投稿 - Qiita | 超簡単!Railsでファビコンを設定してサイトをおしゃれにしよう | https://qiita.com/egutiryuuya/items/670c7444a73e37f9b2db | rails | 2022-11-06 13:31:30 |
海外TECH | DEV Community | How to Make Weather App in React | https://dev.to/reactjsguru/how-to-make-weather-app-in-react-d3f | How to Make Weather App in ReactIn this article we are going to make a weather app in react In this project we will use openweather API which provides us free API to get weather details Here we will add an input field where user will add any city name and as soon city name gets entered an API call will occur and details will be fetched to the screen This App will be completely depends on API So basically this is going to be a beginner friendly project so let s make this project step by step Pre requisites to Make Calculator in ReactBasic knowledge of ReactJS Basic knowledge of React hooks Good knowledge of React Components Adding API And KeyNow before jumping into the code let s get the API and Key which we will use for this project For that we have to move to openweather org site and just login to get API key After that in our App js component we have added a constant in which we have assigned our API key to the key constant and we have provided a URL in our base constant Also we have two cool pictures we will differ at some certain condition import React useState from react const api key fedcddbfbfbffffc base Creating Skeleton For AppNow let s head to our return statement to create the skeleton for the weather app Here we have added an input field with a class and placeholder Then we have added another for location box and then added for location with an initial location to check the output lastly we have added another div where we will add date where we will get date using datebuilder function return lt input type text className search bar placeholder Search gt lt div gt lt div gt lt div className location box gt lt div className location gt New York City US lt div gt lt div className date gt dateBuilder new Date lt div gt lt div gt lt div gt lt main gt lt div gt Creating DateNow let s get today s date for that we have added a function named dateBuilder here we have added an array for months with all month names Then we have added another array for days with all days names Also d is here Date object which we have passed from function call After that we have added a variable for day here we have used days d getDay getDay is a function to get current day Then we have fetched date and similarly month and year which are return to the function call Here you can see we have separately made arrays of months and days because getDay and getMonth function returns the number of the day and month respectively so we just need month name and day name not number const dateBuilder d gt let months January February March April May June July August September October November December let days Sunday Monday Tuesday Wednesday Thursday Friday Saturday let day days d getDay let date d getDate let month months d getMonth let year d getFullYear return day date month year Adding StatesAfter that we have to added our states one for query and another for weather Here query is for to make URL for weather API and weather is for details Then we have added onChange event on input where we are calling the query and also we are calling a function named search on onKeyPress event function App const query setQuery useState const weather setWeather useState return lt div className gt lt main gt lt div className search box gt lt input type text className search bar placeholder Search onChange e gt setQuery e target value value query onKeyPress search gt lt div gt Calling API to Get ResultNow we have defined search function in this we have added a condition where if evt key is equal to Enter If yes then we have used fetch where we have api base weather q query amp appid api key amp units metric this line of code to create the API call and this is query syntax for URL and we used then res gt res json to get results in JSON format After that we have updated weather and query states const search evt gt if evt key Enter fetch api base weather q query amp appid api key amp units metric then res gt res json then result gt setWeather result setQuery console log result Updating The SkeletonNow we have almost done here we have to update our skeleton to get final version of the app Here on with a condition to check weather main is not equal undefined if yes then we will add app warm class otherwise app class These classes are having some CSS to change background picture and style Then we have again checked a condition to check weather is not undefined then we will display location box and weather box At location we have dynamically assigned the location and country Then in the weather box we have assigned the temperature and weather name return lt div className typeof weather main undefined weather main temp gt app warm app app gt lt main gt lt div className search box gt lt input type text className search bar placeholder Search onChange e gt setQuery e target value value query onKeyPress search gt lt div gt typeof weather main undefined lt div gt lt div className location box gt lt div className location gt weather name weather sys country lt div gt lt div className date gt dateBuilder new Date lt div gt lt div gt lt div className weather box gt lt div className temp gt Math round weather main temp °c lt div gt lt div className weather gt weather weather main lt div gt lt div gt lt div gt lt main gt lt div gt Customizing The ApplicationNow our structure is pretty good and we have added almost everything but before going to next move let s add some colors and customize this calculator so this can looks like calculator atleast I won t go deep in CSS because CSS is actually depended on you and this is not that much hard to put color or something So if you want same CSS then use below CSS index css margin padding box sizing border box body font family Montserrat sans serif app background image url assets cold bg jpg background size cover background position bottom transition ease app warm background image url assets warm bg jpg main min height vh background image linear gradient to bottom rgba rgba padding px search box width margin px search box search bar display block width padding px appearance none background none border none outline none background color rgba border radius px px px px margin top px box shadow px px rgba color font size px transition s ease search box search bar focus background color rgba location box location color FFF font size px font weight text align center text shadow px px rgba location box date color FFF font size px font weight font style italic text align center text shadow px px rgba weather box text align center weather box temp position relative display inline block margin px auto background color rgba border radius px padding px px color FFF font size px font weight text shadow px px rgba text align center box shadow px px rgba weather box weather color FFF font size px font weight text shadow px px rgba Read More | 2022-11-06 04:46:16 |
海外TECH | T1 vs DRX / 2022 World Championship / Final / Game 4 Discussion | https://www.reddit.com/r/leagueoflegends/comments/yngg2n/t1_vs_drx_2022_world_championship_final_game_4/ | T vs DRX World Championship Final Game DiscussionQueue the silver scrapes DRX force a game with a masterclass from Kingen and Pyosik DRX T Kingen Aatrox Top Zeus Fiora Pyosik Maokai Jungle Oner Sejuani Zeka Azir Middle Faker Akali Deft Varus Bottom Gumayusi Kalista Beryl Tahm Kench Support Keria Soraka submitted by u ahritina to r leagueoflegends link comments | 2022-11-06 04:20:46 |
コメント
コメントを投稿