├── .gitignore ├── public ├── favicon.ico ├── images │ ├── clear.jpeg │ ├── mist.jpeg │ ├── rain.jpeg │ ├── snow.jpeg │ └── clouds.jpeg ├── global.css └── index.html ├── src ├── main.js ├── ErrorBar.svelte ├── Loading.svelte ├── WeatherContent.svelte ├── App.svelte └── Sidebar.svelte ├── README.md ├── package.json ├── LICENSE └── rollup.config.js /.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules/ 2 | /public/build/ 3 | 4 | .DS_Store 5 | .env -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brdtheo/weatherify/HEAD/public/favicon.ico -------------------------------------------------------------------------------- /public/images/clear.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brdtheo/weatherify/HEAD/public/images/clear.jpeg -------------------------------------------------------------------------------- /public/images/mist.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brdtheo/weatherify/HEAD/public/images/mist.jpeg -------------------------------------------------------------------------------- /public/images/rain.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brdtheo/weatherify/HEAD/public/images/rain.jpeg -------------------------------------------------------------------------------- /public/images/snow.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brdtheo/weatherify/HEAD/public/images/snow.jpeg -------------------------------------------------------------------------------- /public/images/clouds.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brdtheo/weatherify/HEAD/public/images/clouds.jpeg -------------------------------------------------------------------------------- /src/main.js: -------------------------------------------------------------------------------- 1 | import App from './App.svelte'; 2 | 3 | const app = new App({ 4 | target: document.body, 5 | }); 6 | 7 | export default app; -------------------------------------------------------------------------------- /public/global.css: -------------------------------------------------------------------------------- 1 | * { 2 | margin: 0; 3 | padding: 0; 4 | box-sizing: border-box; 5 | } 6 | 7 | :root { 8 | --accent-color: rgba(50, 50, 50, .4); 9 | } 10 | 11 | body { 12 | font-family: 'Jost'; 13 | } 14 | 15 | main { 16 | height: 100%; 17 | } 18 | 19 | body { 20 | height: 100vh; 21 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Weatherify 2 | A realtime weather app built with svelte and some CSS. 3 | 4 | --- 5 | design by [Arthur K](https://dribbble.com/thearthurk) 6 | 7 | ![app-design-1](https://cdn.dribbble.com/users/2158940/screenshots/7118235/media/1ea59d43e8e99a529220bed091f8eb84.png) 8 | 9 | ![app-design-2](https://cdn.dribbble.com/users/2158940/screenshots/7376567/media/35649246137de1ce1d3f68d4ad1e1ffa.png) 10 | 11 | ![app-design-3](https://cdn.dribbble.com/users/2158940/screenshots/7767460/media/603dc6ac6bbeab4287c5a16125e087a6.png) -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "weatherify", 3 | "scripts": { 4 | "build": "rollup -c", 5 | "dev": "rollup -c -w", 6 | "start": "sirv public" 7 | }, 8 | "devDependencies": { 9 | "@rollup/plugin-commonjs": "^17.0.0", 10 | "@rollup/plugin-node-resolve": "^11.0.0", 11 | "@rollup/plugin-replace": "^2.4.1", 12 | "rollup": "^2.3.4", 13 | "rollup-plugin-css-only": "^3.1.0", 14 | "rollup-plugin-livereload": "^2.0.0", 15 | "rollup-plugin-svelte": "^7.0.0", 16 | "rollup-plugin-terser": "^7.0.0", 17 | "svelte": "^3.49.0" 18 | }, 19 | "dependencies": { 20 | "date-fns": "^2.16.1", 21 | "dotenv": "^8.2.0", 22 | "sirv-cli": "^1.0.0" 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Théo Billardey 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /src/ErrorBar.svelte: -------------------------------------------------------------------------------- 1 | 9 | 10 |
11 | error: your request could not be resolved 12 |
13 |
14 | 15 | 53 | -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 10 | Weatherify: Get the weather of any city 11 | 12 | 13 | 14 | 15 | 16 | 21 | 26 | 27 | 28 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /src/Loading.svelte: -------------------------------------------------------------------------------- 1 | 4 | 5 |
6 |
7 |
8 |

Weatherify

9 |
10 |
11 |
12 |

loading...

13 |
14 |
15 |
16 | 17 | 82 | -------------------------------------------------------------------------------- /rollup.config.js: -------------------------------------------------------------------------------- 1 | import { config as configDotenv } from "dotenv"; 2 | configDotenv(); 3 | import replace from "@rollup/plugin-replace"; 4 | const production = !process.env.ROLLUP_WATCH; 5 | import svelte from "rollup-plugin-svelte"; 6 | import commonjs from "@rollup/plugin-commonjs"; 7 | import resolve from "@rollup/plugin-node-resolve"; 8 | import livereload from "rollup-plugin-livereload"; 9 | import { terser } from "rollup-plugin-terser"; 10 | import css from "rollup-plugin-css-only"; 11 | 12 | function serve() { 13 | let server; 14 | 15 | function toExit() { 16 | if (server) server.kill(0); 17 | } 18 | 19 | return { 20 | writeBundle() { 21 | if (server) return; 22 | server = require("child_process").spawn( 23 | "npm", 24 | ["run", "start", "--", "--dev"], 25 | { 26 | stdio: ["ignore", "inherit", "inherit"], 27 | shell: true, 28 | } 29 | ); 30 | 31 | process.on("SIGTERM", toExit); 32 | process.on("exit", toExit); 33 | }, 34 | }; 35 | } 36 | 37 | export default { 38 | input: "src/main.js", 39 | output: { 40 | sourcemap: true, 41 | format: "iife", 42 | name: "app", 43 | file: "public/build/bundle.js", 44 | }, 45 | plugins: [ 46 | replace({ 47 | __myapp: JSON.stringify({ 48 | env: { 49 | isProd: production, 50 | WEATHER_API_KEY: process.env.WEATHER_API_KEY, 51 | }, 52 | }), 53 | }), 54 | svelte({ 55 | compilerOptions: { 56 | // enable run-time checks when not in production 57 | dev: !production, 58 | }, 59 | }), 60 | // we'll extract any component CSS out into 61 | // a separate file - better for performance 62 | css({ output: "bundle.css" }), 63 | 64 | // If you have external dependencies installed from 65 | // npm, you'll most likely need these plugins. In 66 | // some cases you'll need additional configuration - 67 | // consult the documentation for details: 68 | // https://github.com/rollup/plugins/tree/master/packages/commonjs 69 | resolve({ 70 | browser: true, 71 | dedupe: ["svelte"], 72 | }), 73 | commonjs(), 74 | 75 | // In dev mode, call `npm run start` once 76 | // the bundle has been generated 77 | !production && serve(), 78 | 79 | // Watch the `public` directory and refresh the 80 | // browser on changes when not in production 81 | !production && livereload("public"), 82 | 83 | // If we're building for production (npm run build 84 | // instead of npm run dev), minify 85 | production && terser(), 86 | ], 87 | watch: { 88 | clearScreen: false, 89 | }, 90 | }; 91 | -------------------------------------------------------------------------------- /src/WeatherContent.svelte: -------------------------------------------------------------------------------- 1 | 54 | 55 |
56 |
the.weather
57 |
58 |
{temperature}
59 |
60 |

{city}

61 | {date} 62 |
63 |
64 | 65 | {state} 66 |
67 |
68 |
69 | 70 | 184 | -------------------------------------------------------------------------------- /src/App.svelte: -------------------------------------------------------------------------------- 1 | 138 | 139 |
140 | {#if backgroundImage} 141 |
145 |
146 | {#if loading} 147 | 148 | {/if} 149 | 150 | 157 |
158 |
159 | {/if} 160 | 161 | {#if error} 162 | 163 | {/if} 164 |
165 | 166 | 209 | -------------------------------------------------------------------------------- /src/Sidebar.svelte: -------------------------------------------------------------------------------- 1 | 70 | 71 | 133 | 134 | 265 | --------------------------------------------------------------------------------