From 9bd464227f9667024c199f08ebb2dedaa04048df Mon Sep 17 00:00:00 2001 From: aviral hatwal <119874648+cyberviking5@users.noreply.github.com> Date: Thu, 5 Oct 2023 03:27:25 +0530 Subject: [PATCH] Weather App (#635) * Weather App * cleanup * Removing consoles * Cleanup --- .../kitchen-sink/src/examples/redux-todo.tsx | 1 - .../kitchen-sink/src/examples/weather-app.tsx | 149 ++++++++++++++++++ packages/kitchen-sink/src/main.tsx | 10 +- 3 files changed, 157 insertions(+), 3 deletions(-) create mode 100644 packages/kitchen-sink/src/examples/weather-app.tsx diff --git a/packages/kitchen-sink/src/examples/redux-todo.tsx b/packages/kitchen-sink/src/examples/redux-todo.tsx index 6fbb0ae8bf..074e29bebb 100644 --- a/packages/kitchen-sink/src/examples/redux-todo.tsx +++ b/packages/kitchen-sink/src/examples/redux-todo.tsx @@ -68,7 +68,6 @@ const MainTodoApp = block(() => { const TodoApp = () => { const [input, setInput] = useState(''); - const count = useSelector( (state: { todo: typeof initialState }) => state.todo.count, ); diff --git a/packages/kitchen-sink/src/examples/weather-app.tsx b/packages/kitchen-sink/src/examples/weather-app.tsx new file mode 100644 index 0000000000..faaba8ba43 --- /dev/null +++ b/packages/kitchen-sink/src/examples/weather-app.tsx @@ -0,0 +1,149 @@ +import styled from 'styled-components'; +import { useState } from 'react'; +import React from 'react'; +import { block } from 'million/react'; + +const Condition = styled.span` + margin: 20px auto; + text-transform: capitalize; + font-size: 14px; + & span { + font-size: 28px; + } +`; + +const SearchBox = styled.form` + display: flex; + flex-direction: row; + justify-content: space-evenly; + margin: 20px; + border: black solid 1px; + border-radius: 2px; + + & input { + padding: 10px; + font-size: 14px; + border: none; + outline: none; + font-family: Montserrat; + font-weight: bold; + } + & button { + background-color: blue; + font-size: 14px; + padding: 0 10px; + color: white; + border: none; + outline: none; + cursor: pointer; + font-family: Montserrat; + font-weight: bold; + } +`; +const ChooseCityLabel = styled.span` + color: white; + margin: 10px auto; + font-size: 18px; + font-weight: bold; +`; +const WelcomeWeatherLogo = styled.img` + width: 140px; + height: 140px; + margin: 40px auto; +`; + +type Weather = { + city: string; + weatherDesc: string | undefined; + temp: any; +}; + +const WeatherComponent = block(({ city, weatherDesc, temp }: Weather) => { + return ( +