├── .env.example ├── .eslintignore ├── .prettierignore ├── .github └── FUNDING.yml ├── next.config.js ├── public ├── favicon.ico └── og-image.png ├── vercel.json ├── .prettierrc.js ├── jsconfig.json ├── src ├── pages │ ├── index.js │ ├── _document.js │ ├── _app.js │ ├── rs.js │ └── rs-detail.js ├── styles │ ├── theme.js │ ├── styles.js │ └── css │ │ └── nprogress.css └── components │ ├── PageContainer.js │ ├── ToggleMode.js │ ├── Footer.js │ ├── BedCard.js │ ├── Search.js │ └── HospitalCard.js ├── .gitignore ├── next-seo.config.js ├── .eslintrc.js ├── LICENSE ├── package.json ├── README.md └── yarn.lock /.env.example: -------------------------------------------------------------------------------- 1 | NEXT_PUBLIC_API_URL = '' -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | // .eslintignore 2 | node_modules 3 | db -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | # Ignore : 2 | build 3 | .next 4 | node_modules -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | custom: ['https://saweria.co/hendraaagil'] 2 | ko_fi: hendraaagil -------------------------------------------------------------------------------- /next.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | images: { 3 | domains: [''], 4 | }, 5 | }; 6 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hendraaagil/bed-covid-rs-indo/HEAD/public/favicon.ico -------------------------------------------------------------------------------- /public/og-image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hendraaagil/bed-covid-rs-indo/HEAD/public/og-image.png -------------------------------------------------------------------------------- /vercel.json: -------------------------------------------------------------------------------- 1 | { 2 | "redirects": [ 3 | { 4 | "source": "/api", 5 | "destination": "https://rs-bed-covid-api.vercel.app/" 6 | } 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /.prettierrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | tabWidth: 2, 3 | printWidth: 80, 4 | endOfLine: 'auto', 5 | arrowParens: 'always', 6 | semi: true, 7 | useTabs: false, 8 | singleQuote: true, 9 | bracketSpacing: true, 10 | }; 11 | -------------------------------------------------------------------------------- /jsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "baseUrl": ".", 4 | "paths": { 5 | "@/components/*": ["./src/components/*"], 6 | "@/styles/*": ["./src/styles/*"] 7 | } 8 | }, 9 | "exclude": ["node_modules", ".next", "out"], 10 | "include": ["**/*.js"] 11 | } -------------------------------------------------------------------------------- /src/pages/index.js: -------------------------------------------------------------------------------- 1 | import PageContainer from '@/components/PageContainer'; 2 | import Search from '@/components/Search'; 3 | 4 | export default function Home() { 5 | return ( 6 | 7 | 8 | 9 | ); 10 | } 11 | -------------------------------------------------------------------------------- /src/styles/theme.js: -------------------------------------------------------------------------------- 1 | import { theme as defaultTheme, extendTheme } from '@chakra-ui/react'; 2 | import { createBreakpoints } from '@chakra-ui/theme-tools'; 3 | 4 | const breakpoints = createBreakpoints({ 5 | sm: '425px', 6 | md: '768px', 7 | lg: '960px', 8 | xl: '1280px', 9 | '2xl': '1440px', 10 | }); 11 | 12 | const theme = extendTheme({ 13 | fonts: { 14 | heading: `'Lexend', ${defaultTheme.fonts.heading}`, 15 | body: `'Lexend', ${defaultTheme.fonts.body}`, 16 | }, 17 | breakpoints, 18 | }); 19 | 20 | export default theme; 21 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # next.js 12 | /.next/ 13 | /out/ 14 | 15 | # production 16 | /build 17 | 18 | # misc 19 | .DS_Store 20 | *.pem 21 | 22 | # debug 23 | npm-debug.log* 24 | yarn-debug.log* 25 | yarn-error.log* 26 | 27 | # local env files 28 | .env 29 | .env.local 30 | .env.development.local 31 | .env.test.local 32 | .env.production.local 33 | 34 | # vercel 35 | .vercel 36 | -------------------------------------------------------------------------------- /src/components/PageContainer.js: -------------------------------------------------------------------------------- 1 | import { Divider, Heading, useColorModeValue, VStack } from '@chakra-ui/react'; 2 | 3 | const PageContainer = ({ children, title }) => ( 4 | 16 | 17 | {title} 18 | 19 | 20 | {children} 21 | 22 | ); 23 | 24 | export default PageContainer; 25 | -------------------------------------------------------------------------------- /src/styles/styles.js: -------------------------------------------------------------------------------- 1 | import { Global, css } from '@emotion/react'; 2 | import { useColorModeValue } from '@chakra-ui/react'; 3 | 4 | const GlobalStyle = ({ children }) => ( 5 | <> 6 | 21 | {children} 22 | 23 | ); 24 | 25 | export default GlobalStyle; 26 | -------------------------------------------------------------------------------- /src/components/ToggleMode.js: -------------------------------------------------------------------------------- 1 | import { IconButton, useColorMode } from '@chakra-ui/react'; 2 | import { FaRegMoon, FaRegSun } from 'react-icons/fa'; 3 | 4 | const ToggleMode = () => { 5 | const { colorMode, toggleColorMode } = useColorMode(); 6 | 7 | return ( 8 | : } 11 | onClick={toggleColorMode} 12 | pos="fixed" 13 | m={3} 14 | bottom={0} 15 | rounded="md" 16 | zIndex="docked" 17 | sx={{ 18 | bg: 19 | colorMode === 'light' 20 | ? 'rgba(237, 242, 247, 0.5)' 21 | : 'rgba(26, 32, 44, 0.5)', 22 | backdropFilter: 'blur(10px)', 23 | }} 24 | /> 25 | ); 26 | }; 27 | 28 | export default ToggleMode; 29 | -------------------------------------------------------------------------------- /next-seo.config.js: -------------------------------------------------------------------------------- 1 | const title = 'Bed Covid RS Indonesia'; 2 | const description = 3 | 'Website yang memberikan informasi terkait ketersediaan rumah sakit dan tempat tidur rumah sakit untuk pasien covid-19 ataupun non-covid di Indonesia.'; 4 | const url = 'https://bed-covid-rs-indo.vercel.app'; 5 | 6 | const SEO = { 7 | title, 8 | description, 9 | canonical: url, 10 | openGraph: { 11 | type: 'website', 12 | url, 13 | title, 14 | description, 15 | images: [ 16 | { 17 | url: `${url}/og-image.png`, 18 | alt: title, 19 | width: 1200, 20 | height: 630, 21 | }, 22 | ], 23 | }, 24 | twitter: { 25 | cardType: 'summary_large_image', 26 | handle: '@hendraaagil', 27 | site: '@hendraaagil', 28 | }, 29 | additionalLinkTags: [{ rel: 'icon', href: '/favicon.ico' }], 30 | }; 31 | 32 | export default SEO; 33 | -------------------------------------------------------------------------------- /src/components/Footer.js: -------------------------------------------------------------------------------- 1 | import { 2 | Divider, 3 | HStack, 4 | Link, 5 | useColorModeValue, 6 | VStack, 7 | } from '@chakra-ui/react'; 8 | import { FaGithub } from 'react-icons/fa'; 9 | 10 | const Footer = () => ( 11 | 18 | 19 | 20 | 21 | GitHub Repository 22 | 23 | 24 | 28 | API Source 29 | 30 | 31 | 32 | ); 33 | 34 | export default Footer; 35 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | parserOptions: { 3 | ecmaVersion: 2020, 4 | sourceType: 'module', 5 | ecmaFeatures: { 6 | jsx: true, 7 | }, 8 | }, 9 | env: { 10 | browser: true, 11 | node: true, 12 | es6: true, 13 | }, 14 | settings: { 15 | 'import/resolver': { 16 | node: { 17 | paths: ['.'], 18 | extensions: ['.js', '.jsx'], 19 | }, 20 | }, 21 | react: { 22 | version: 'detect', 23 | }, 24 | }, 25 | extends: ['plugin:react/recommended', 'next', 'airbnb', 'prettier'], 26 | plugins: ['react', 'prettier'], 27 | rules: { 28 | 'react/react-in-jsx-scope': 'off', 29 | 'react/prop-types': 'off', 30 | 'react/jsx-filename-extension': [1, { extensions: ['.js', '.jsx'] }], 31 | 'react/jsx-props-no-spreading': 'off', 32 | '@next/next/no-page-custom-font': 'off', 33 | 'import/no-unresolved': 'off', 34 | 'no-plusplus': 'off', 35 | }, 36 | }; 37 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Hendra Agil Syaputra 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/pages/_document.js: -------------------------------------------------------------------------------- 1 | import NextDocument, { Html, Head, Main, NextScript } from 'next/document'; 2 | import { ColorModeScript } from '@chakra-ui/react'; 3 | 4 | export default class MyDocument extends NextDocument { 5 | static async getInitialProps(ctx) { 6 | const initialProps = await NextDocument.getInitialProps(ctx); 7 | return { ...initialProps }; 8 | } 9 | 10 | render() { 11 | return ( 12 | 13 | 14 | 15 | 16 | 17 | 18 | 23 | 27 | 28 | 29 | 30 | 31 |
32 | 33 | 34 | 35 | ); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "bed-covid-rs-indo", 3 | "version": "1.0.2", 4 | "private": true, 5 | "author": "Hendra Agil <@hendraaagil>", 6 | "scripts": { 7 | "dev": "next dev", 8 | "build": "next build", 9 | "start": "next start", 10 | "lint": "eslint ./src/components/** ./src/pages/** -c .eslintrc.js --ext js,jsx", 11 | "lint-fix": "eslint ./src/components/** ./src/pages/** -c .eslintrc.js --fix --ext js,jsx" 12 | }, 13 | "dependencies": { 14 | "@chakra-ui/react": "^1.6.4", 15 | "@chakra-ui/theme-tools": "^1.1.7", 16 | "@emotion/react": "11", 17 | "@emotion/styled": "11", 18 | "framer-motion": "4", 19 | "next": "12.1.0", 20 | "next-seo": "^4.26.0", 21 | "nprogress": "^0.2.0", 22 | "react": "17.0.2", 23 | "react-dom": "17.0.2", 24 | "react-icons": "^4.2.0", 25 | "swr": "^0.5.6" 26 | }, 27 | "devDependencies": { 28 | "eslint": "^7.29.0", 29 | "eslint-config-airbnb": "^18.2.1", 30 | "eslint-config-next": "^11.0.0", 31 | "eslint-config-prettier": "^8.3.0", 32 | "eslint-plugin-import": "^2.23.4", 33 | "eslint-plugin-jsx-a11y": "^6.4.1", 34 | "eslint-plugin-prettier": "^3.4.0", 35 | "eslint-plugin-react": "^7.24.0", 36 | "prettier": "^2.3.1" 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Bed Covid RS Indonesia 2 | 3 | ![Bed Covid RS Indonesia](public/og-image.png) 4 | 5 | Website yang memberikan informasi terkait ketersediaan rumah sakit dan tempat tidur rumah sakit untuk pasien covid-19 ataupun non-covid di Indonesia. 6 | 7 | ## Instalasi 8 | 9 | 1. Klon repositori ini
10 | ``` 11 | git clone https://github.com/hendraaagil/bed-covid-rs-indo.git 12 | ``` 13 | 2. Unduh semua dependensi
14 | ``` 15 | yarn 16 | ``` 17 | 3. Konfigurasi _file_ `.env`
18 | ``` 19 | NEXT_PUBLIC_API_URL = '' 20 | ``` 21 | 4. Jalankan _project_
22 | ``` 23 | yarn dev 24 | ``` 25 | 26 | ## Teknologi yang digunakan 27 | 28 | - [Next.js](https://nextjs.org/) 29 | - [Chakra UI](https://chakra-ui.com/) 30 | 31 | Menggunakan _starter template_: [hendraaagil/next-chakra-starter](https://github.com/hendraaagil/next-chakra-starter). 32 | 33 | ## Fitur 34 | 35 | - [x] Menampilkan daftar rumah sakit berdasarkan provinsi dan kabupaten / kota. 36 | - [x] Menampilkan detail rumah sakit. 37 | 38 | ## Sumber data 39 | 40 | Sumber data website ini berasal dari publik API: [satyawikananda/rs-bed-covid-indo-api](https://github.com/satyawikananda/rs-bed-covid-indo-api). 41 | 42 | ## Kontribusi 43 | 44 | Jika menemukan _bug_ atau kesalahan silahkan lapor ke _issue_ atau jika ingin berkontribusi silahkan buat _pull request_. 45 | 46 | ## Referensi 47 | 48 | - [Ina Covid Bed](https://github.com/agallio/ina-covid-bed) 49 | 50 | --- 51 | 52 | Kode ini berlisensi di bawah [MIT License](LICENSE). 53 | -------------------------------------------------------------------------------- /src/pages/_app.js: -------------------------------------------------------------------------------- 1 | import Router from 'next/router'; 2 | import NProgress from 'nprogress'; 3 | 4 | import { DefaultSeo } from 'next-seo'; 5 | import { Box, ChakraProvider } from '@chakra-ui/react'; 6 | import { AnimatePresence, motion } from 'framer-motion'; 7 | 8 | import SEO from 'next-seo.config'; 9 | import theme from '@/styles/theme'; 10 | import GlobalStyle from '@/styles/styles'; 11 | import '@/styles/css/nprogress.css'; 12 | 13 | import ToggleMode from '@/components/ToggleMode'; 14 | import Footer from '@/components/Footer'; 15 | 16 | Router.events.on('routeChangeStart', () => NProgress.start()); 17 | Router.events.on('routeChangeComplete', () => NProgress.done()); 18 | Router.events.on('routeChangeError', () => NProgress.done()); 19 | 20 | const MotionBox = motion(Box); 21 | 22 | function MyApp({ Component, pageProps, router }) { 23 | return ( 24 | 25 | 26 | 27 | 28 | 29 | 30 | 43 | 44 | 45 | 46 |