├── netlify.toml ├── postcss.config.js ├── src ├── Index.re ├── assets │ ├── favicon_io │ │ ├── favicon.ico │ │ ├── favicon-16x16.png │ │ ├── favicon-32x32.png │ │ ├── apple-touch-icon.png │ │ ├── android-chrome-192x192.png │ │ ├── android-chrome-512x512.png │ │ └── site.webmanifest │ ├── github.svg │ └── coronaSafeLogo.svg ├── utils │ └── ArrayUtils.re ├── types │ ├── Data.re │ ├── Url.re │ ├── Question.re │ ├── Answer.re │ └── Quiz.re ├── components │ ├── QuizComponent.css │ ├── Home.css │ ├── dataSchema.json │ ├── Home.re │ ├── QuizComponent.re │ └── data.json └── tailwind.css ├── .gitignore ├── .github └── workflows │ └── test.yml ├── bsconfig.json ├── README.md ├── tests └── schema.test.js ├── package.json ├── LICENSE ├── index.html └── CODE_OF_CONDUCT.md /netlify.toml: -------------------------------------------------------------------------------- 1 | [[redirects]] 2 | from = "/*" 3 | to = "/index.html" 4 | status = 200 5 | -------------------------------------------------------------------------------- /postcss.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: [require("tailwindcss"), require("autoprefixer")] 3 | }; 4 | -------------------------------------------------------------------------------- /src/Index.re: -------------------------------------------------------------------------------- 1 | [%bs.raw {|require("./tailwind.css")|}]; 2 | ReactDOMRe.renderToElementWithId(, "root"); 3 | -------------------------------------------------------------------------------- /src/assets/favicon_io/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ohcnetwork/awareness/HEAD/src/assets/favicon_io/favicon.ico -------------------------------------------------------------------------------- /src/assets/favicon_io/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ohcnetwork/awareness/HEAD/src/assets/favicon_io/favicon-16x16.png -------------------------------------------------------------------------------- /src/assets/favicon_io/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ohcnetwork/awareness/HEAD/src/assets/favicon_io/favicon-32x32.png -------------------------------------------------------------------------------- /src/assets/favicon_io/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ohcnetwork/awareness/HEAD/src/assets/favicon_io/apple-touch-icon.png -------------------------------------------------------------------------------- /src/assets/favicon_io/android-chrome-192x192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ohcnetwork/awareness/HEAD/src/assets/favicon_io/android-chrome-192x192.png -------------------------------------------------------------------------------- /src/assets/favicon_io/android-chrome-512x512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ohcnetwork/awareness/HEAD/src/assets/favicon_io/android-chrome-512x512.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore these associated with reason-react and bsb 2 | .merlin 3 | npm-debug.log 4 | .DS_Store 5 | .bsb.lock 6 | *.bs.js 7 | 8 | /lib/bs/ 9 | /node_modules/ 10 | /bundleOutput/ 11 | _redirects 12 | build/ 13 | yarn.lock 14 | /dist 15 | .cache 16 | -------------------------------------------------------------------------------- /src/utils/ArrayUtils.re: -------------------------------------------------------------------------------- 1 | let getOpt = (a, i) => 2 | try(Some(a |> Array.get(i))) { 3 | | Not_found => None 4 | }; 5 | 6 | let isEmpty = a => 7 | switch (a) { 8 | | [||] => true 9 | | _ => false 10 | }; 11 | 12 | let isNotEmpty = a => !(a |> isEmpty); 13 | -------------------------------------------------------------------------------- /src/types/Data.re: -------------------------------------------------------------------------------- 1 | type t = { 2 | quiz: array(Quiz.t), 3 | links: array(string), 4 | }; 5 | 6 | let make = (quiz, links) => {quiz, links}; 7 | 8 | let makeData = json => { 9 | make(json##quiz |> Quiz.makeArray, json##links); 10 | }; 11 | 12 | let quiz = t => t.quiz; 13 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: Node.js CI 2 | on: [ push, pull_request ] 3 | 4 | jobs: 5 | test: 6 | runs-on: ubuntu-latest 7 | steps: 8 | - uses: actions/checkout@v2 9 | - name: Use Node.js 10 | uses: actions/setup-node@v1 11 | - run: npm ci 12 | - run: npm run re:build 13 | - run: npm run build 14 | - run: npm test 15 | env: 16 | CI: true -------------------------------------------------------------------------------- /src/types/Url.re: -------------------------------------------------------------------------------- 1 | module Quiz = { 2 | let parse = questionFragment => 3 | try( 4 | Some( 5 | { 6 | let v = int_of_string(questionFragment); 7 | if (v < 0) { 8 | 0; /* Quick and dirty validation */ 9 | } else { 10 | v - 1; 11 | }; 12 | }, 13 | ) 14 | ) { 15 | | _ => None 16 | }; 17 | }; 18 | -------------------------------------------------------------------------------- /bsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "tailwind-starter", 3 | "reason": { 4 | "react-jsx": 3 5 | }, 6 | "sources": { 7 | "dir": "src", 8 | "subdirs": true 9 | }, 10 | "bsc-flags": ["-bs-super-errors", "-bs-no-version-header"], 11 | "package-specs": [ 12 | { 13 | "module": "commonjs", 14 | "in-source": true 15 | } 16 | ], 17 | "suffix": ".bs.js", 18 | "bs-dependencies": ["reason-react"], 19 | "refmt": 3, 20 | "warnings": { 21 | "error": "+8" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Corona Awareness App | Corona Literacy Mission 2 | ![Corona Safe Logo](https://res.cloudinary.com/bodhi/image/upload/v1584022097/apps/coronasafe/Coronasafe-logo_b6fclm.png) 3 | 4 | The Corona Awareness app was built as part of the Corona Literacy Mission to help people learn about hygiene practices and protective measures against the COVID-19 outbreak via a series of Quizzes. 5 | 6 | ## Run Project 7 | 8 | ```sh 9 | npm install 10 | npm run dev 11 | # in another tab 12 | npm run re:watch 13 | ``` 14 | -------------------------------------------------------------------------------- /src/assets/favicon_io/site.webmanifest: -------------------------------------------------------------------------------- 1 | { 2 | "name": "", 3 | "short_name": "", 4 | "icons": [ 5 | { 6 | "src": "/src/assets/favicon_io/android-chrome-192x192.png", 7 | "sizes": "192x192", 8 | "type": "image/png" 9 | }, 10 | { 11 | "src": "/src/assets/favicon_io/android-chrome-512x512.png", 12 | "sizes": "512x512", 13 | "type": "image/png" 14 | } 15 | ], 16 | "theme_color": "#ffffff", 17 | "background_color": "#ffffff", 18 | "display": "standalone" 19 | } 20 | -------------------------------------------------------------------------------- /tests/schema.test.js: -------------------------------------------------------------------------------- 1 | const chai = require('chai'); 2 | const schema = require("../src/components/dataSchema.json"); 3 | 4 | chai.use(require('chai-json-schema')); 5 | const expect = chai.expect; 6 | 7 | const data = (function(){ 8 | const fs = require('fs'); 9 | const stripJsonComments = require('strip-json-comments'); 10 | const text = fs.readFileSync("src/components/data.json").toString(); 11 | return JSON.parse(stripJsonComments(text)); 12 | })() 13 | 14 | describe("Data", function() { 15 | it("should be properly validated by the json schema", function() { 16 | expect(data).to.be.jsonSchema(schema); 17 | }); 18 | }); -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "tailwind-starter", 3 | "version": "0.1.0", 4 | "license": "MIT", 5 | "devDependencies": { 6 | "bs-platform": "7.0.1", 7 | "chai": "^4.2.0", 8 | "chai-json-schema": "^1.5.1", 9 | "mocha": "^7.1.1", 10 | "parcel-bundler": "^1.12.4", 11 | "strip-json-comments": "^3.0.1", 12 | "tailwindcss": "^1.1.4" 13 | }, 14 | "dependencies": { 15 | "minimist": "^1.2.5", 16 | "reason-react": ">=0.7.0" 17 | }, 18 | "scripts": { 19 | "dev": "parcel index.html", 20 | "build": "parcel build index.html", 21 | "test": "mocha tests", 22 | "re:build": "bsb -make-world -clean-world", 23 | "re:watch": "bsb -make-world -clean-world -w" 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/components/QuizComponent.css: -------------------------------------------------------------------------------- 1 | .quiz-component__container { 2 | position: relative; 3 | } 4 | 5 | .quiz-component__container::before { 6 | @apply bg-gray-800 absolute rounded-lg; 7 | content: ""; 8 | bottom: -8px; 9 | right: -8px; 10 | z-index: -1; 11 | width: 100%; 12 | height: 100%; 13 | } 14 | 15 | @screen md { 16 | .quiz-component__container::before { 17 | bottom: -12px; 18 | right: -12px; 19 | } 20 | } 21 | 22 | .quiz-component__video-wrapper { 23 | position: relative; 24 | padding-bottom: 56.25%; 25 | /* 16:9 */ 26 | height: 0; 27 | } 28 | 29 | .quiz-component__video-wrapper iframe { 30 | position: absolute; 31 | top: 0; 32 | left: 0; 33 | width: 100%; 34 | height: 100%; 35 | } 36 | -------------------------------------------------------------------------------- /src/types/Question.re: -------------------------------------------------------------------------------- 1 | type t = { 2 | title: string, 3 | description: string, 4 | answers: array(Answer.t), 5 | hint: option(string), 6 | imageUrl: option(string), 7 | }; 8 | let make = (~title, ~description, ~imageUrl=None, ~answers, ~hint) => { 9 | {title, description, imageUrl, answers, hint}; 10 | }; 11 | 12 | let title = t => t.title; 13 | let description = t => t.description; 14 | let answers = t => t.answers; 15 | let hint = t => t.hint; 16 | let imageUrl = t => t.imageUrl; 17 | 18 | let makeArray = questions => { 19 | questions 20 | |> Array.map(a => 21 | make( 22 | ~title=a##title, 23 | ~description=a##description, 24 | ~imageUrl=a##imageUrl |> Js.Nullable.toOption, 25 | ~answers=a##answers |> Answer.makeArray, 26 | ~hint=a##hint, 27 | ) 28 | ); 29 | }; 30 | -------------------------------------------------------------------------------- /src/components/Home.css: -------------------------------------------------------------------------------- 1 | .main { 2 | min-height: 100vh; 3 | display: flex; 4 | flex-direction: column; 5 | } 6 | 7 | .home__container { 8 | position: relative; 9 | } 10 | 11 | .github_svg { 12 | transition: all 0.3s ease-in-out; 13 | } 14 | 15 | .github_svg:hover { 16 | transform: translateY(-5px); 17 | } 18 | 19 | .home__container::before { 20 | @apply bg-gray-800 absolute rounded-lg; 21 | content: ""; 22 | bottom: -8px; 23 | right: -8px; 24 | z-index: -1; 25 | width: 100%; 26 | height: 100%; 27 | } 28 | 29 | @screen md { 30 | .home__container::before { 31 | bottom: -12px; 32 | right: -12px; 33 | } 34 | } 35 | 36 | .home-langualge-filter__link { 37 | @apply font-semibold pt-2 py-1 px-1 border-b-2 border-transparent mr-4 cursor-pointer tracking-wide; 38 | } 39 | 40 | .home-langualge-filter__link--active { 41 | @apply text-gray-900 border-gray-900; 42 | } 43 | -------------------------------------------------------------------------------- /src/assets/github.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/types/Answer.re: -------------------------------------------------------------------------------- 1 | type t = { 2 | option: string, 3 | title: string, 4 | description: array(string), 5 | imageUrl: option(string), 6 | youtubeUrl: option(string), 7 | correctAnswer: bool, 8 | }; 9 | 10 | let make = 11 | ( 12 | ~option, 13 | ~title, 14 | ~description, 15 | ~imageUrl=None, 16 | ~youtubeUrl=None, 17 | ~correctAnswer, 18 | ) => { 19 | {option, title, description, imageUrl, youtubeUrl, correctAnswer}; 20 | }; 21 | 22 | let option = t => t.option; 23 | let title = t => t.title; 24 | let description = t => t.description; 25 | let youtubeUrl = t => t.youtubeUrl; 26 | let imageUrl = t => t.imageUrl; 27 | let correctAnswer = t => t.correctAnswer; 28 | 29 | let makeArray = answers => { 30 | answers 31 | |> Array.map(a => { 32 | make( 33 | ~option=a##option, 34 | ~title=a##title, 35 | ~description=a##description |> Array.map(d => d), 36 | ~imageUrl=a##imageUrl |> Js.Nullable.toOption, 37 | ~youtubeUrl=a##youtubeUrl |> Js.Nullable.toOption, 38 | ~correctAnswer=a##correctAnswer, 39 | ) 40 | }); 41 | }; 42 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Corona Safe 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/types/Quiz.re: -------------------------------------------------------------------------------- 1 | type t = { 2 | title: string, 3 | path: string, 4 | questions: array(Question.t), 5 | buttonText: string, 6 | readMore: string, 7 | successMessage: string, 8 | description: string, 9 | language: string, 10 | }; 11 | 12 | let make = 13 | ( 14 | ~title, 15 | ~path, 16 | ~questions, 17 | ~buttonText, 18 | ~readMore, 19 | ~successMessage, 20 | ~description, 21 | ~language, 22 | ) => { 23 | { 24 | title, 25 | path, 26 | questions, 27 | buttonText, 28 | successMessage, 29 | readMore, 30 | description, 31 | language, 32 | }; 33 | }; 34 | 35 | let title = t => t.title; 36 | let path = t => t.path; 37 | let questions = t => t.questions; 38 | let buttonText = t => t.buttonText; 39 | let readMore = t => t.readMore; 40 | let successMessage = t => t.successMessage; 41 | let description = t => t.description; 42 | let language = t => t.language; 43 | 44 | let makeArray = json => { 45 | json 46 | |> Array.map(a => 47 | make( 48 | ~title=a##title, 49 | ~path=a##path, 50 | ~questions=a##questions |> Question.makeArray, 51 | ~buttonText=a##buttonText, 52 | ~readMore=a##readMore, 53 | ~successMessage=a##successMessage, 54 | ~description=a##description, 55 | ~language=a##language, 56 | ) 57 | ); 58 | }; 59 | 60 | let findOpt = (path, quiz) => { 61 | let filteredQuizArray = quiz |> Js.Array.filter(q => q.path == path); 62 | filteredQuizArray |> ArrayUtils.isEmpty 63 | ? None : filteredQuizArray |> ArrayUtils.getOpt(0); 64 | }; 65 | 66 | let filterByLang = (language, quiz) => { 67 | quiz |> Js.Array.filter(q => q.language == language); 68 | }; 69 | 70 | let default = quiz => { 71 | quiz |> filterByLang("english"); 72 | }; 73 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Corona Safe - Corona Literacy Mission 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 19 | 21 | 22 | 23 | 24 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 41 | 42 | 43 | 44 |
45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /src/components/dataSchema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-07/schema#", 3 | "title": "AwarnessQuizz", 4 | "type": "object", 5 | "required": [ "quiz" ], 6 | "properties": { 7 | "quiz": { 8 | "type": "array", 9 | "items": { 10 | "$ref": "#/definitions/quizzObject" 11 | } 12 | } 13 | }, 14 | "definitions": { 15 | "quizzObject": { 16 | "type": "object", 17 | "required": [ "title", "description", "path", "buttonText", "successMessage", "readMore", "questions" ], 18 | "properties": { 19 | "language": { 20 | "type": "string" 21 | }, 22 | "title": { 23 | "type": "string" 24 | }, 25 | "description": { 26 | "type": "string" 27 | }, 28 | "path": { 29 | "type": "string" 30 | }, 31 | "buttonText": { 32 | "type": "string" 33 | }, 34 | "successMessage": { 35 | "type": "string" 36 | }, 37 | "readMore": { 38 | "type": "string" 39 | }, 40 | "questions": { 41 | "type": "array", 42 | "items": { 43 | "$ref": "#/definitions/questionObject" 44 | } 45 | } 46 | }, 47 | "additionalProperties": false 48 | }, 49 | "answerObject": { 50 | "type": "object", 51 | "required": [ "option", "title", "description", "correctAnswer" ], 52 | "properties": { 53 | "option": { 54 | "type": "string" 55 | }, 56 | "title": { 57 | "type": "string" 58 | }, 59 | "description": { 60 | "type": "array", 61 | "items": { 62 | "type": "string" 63 | } 64 | }, 65 | "imageUrl": { 66 | "type": "string" 67 | }, 68 | "youtubeUrl": { 69 | "type": "string" 70 | }, 71 | "correctAnswer": { 72 | "type": "boolean" 73 | } 74 | }, 75 | "additionalProperties": false 76 | }, 77 | "questionObject": { 78 | "type": "object", 79 | "required": [ "title", "description", "hint", "answers" ], 80 | "properties": { 81 | "title": { 82 | "type": "string" 83 | }, 84 | "description": { 85 | "type": "string" 86 | }, 87 | "hint": { 88 | "type": "string" 89 | }, 90 | "answers": { 91 | "type": "array", 92 | "minItems": 2, 93 | "items": { 94 | "$ref": "#/definitions/answerObject" 95 | } 96 | } 97 | }, 98 | "additionalProperties": false 99 | } 100 | } 101 | } -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to making participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, sex characteristics, gender identity and expression, 9 | level of experience, education, socio-economic status, nationality, personal 10 | appearance, race, religion, or sexual identity and orientation. 11 | 12 | ## Our Standards 13 | 14 | Examples of behavior that contributes to creating a positive environment 15 | include: 16 | 17 | * Using welcoming and inclusive language 18 | * Being respectful of differing viewpoints and experiences 19 | * Gracefully accepting constructive criticism 20 | * Focusing on what is best for the community 21 | * Showing empathy towards other community members 22 | 23 | Examples of unacceptable behavior by participants include: 24 | 25 | * The use of sexualized language or imagery and unwelcome sexual attention or 26 | advances 27 | * Trolling, insulting/derogatory comments, and personal or political attacks 28 | * Public or private harassment 29 | * Publishing others' private information, such as a physical or electronic 30 | address, without explicit permission 31 | * Other conduct which could reasonably be considered inappropriate in a 32 | professional setting 33 | 34 | ## Our Responsibilities 35 | 36 | Project maintainers are responsible for clarifying the standards of acceptable 37 | behavior and are expected to take appropriate and fair corrective action in 38 | response to any instances of unacceptable behavior. 39 | 40 | Project maintainers have the right and responsibility to remove, edit, or 41 | reject comments, commits, code, wiki edits, issues, and other contributions 42 | that are not aligned to this Code of Conduct, or to ban temporarily or 43 | permanently any contributor for other behaviors that they deem inappropriate, 44 | threatening, offensive, or harmful. 45 | 46 | ## Scope 47 | 48 | This Code of Conduct applies both within project spaces and in public spaces 49 | when an individual is representing the project or its community. Examples of 50 | representing a project or community include using an official project e-mail 51 | address, posting via an official social media account, or acting as an appointed 52 | representative at an online or offline event. Representation of a project may be 53 | further defined and clarified by project maintainers. 54 | 55 | ## Enforcement 56 | 57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 58 | reported by contacting the project team at bodhish@gmail.com. All 59 | complaints will be reviewed and investigated and will result in a response that 60 | is deemed necessary and appropriate to the circumstances. The project team is 61 | obligated to maintain confidentiality with regard to the reporter of an incident. 62 | Further details of specific enforcement policies may be posted separately. 63 | 64 | Project maintainers who do not follow or enforce the Code of Conduct in good 65 | faith may face temporary or permanent repercussions as determined by other 66 | members of the project's leadership. 67 | 68 | ## Attribution 69 | 70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, 71 | available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html 72 | 73 | [homepage]: https://www.contributor-covenant.org 74 | 75 | For answers to common questions about this code of conduct, see 76 | https://www.contributor-covenant.org/faq 77 | -------------------------------------------------------------------------------- /src/tailwind.css: -------------------------------------------------------------------------------- 1 | @tailwind base; 2 | @tailwind components; 3 | @tailwind utilities; 4 | /* Custom utilities */ 5 | 6 | .max-w-fc { 7 | max-width: fit-content; 8 | } 9 | 10 | /* Custom Style */ 11 | 12 | html { 13 | width: 100%; 14 | height: 100%; 15 | } 16 | 17 | body { 18 | font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Helvetica Neue", Arial, sans-serif; 19 | color: #33312D; 20 | @apply w-full antialiased bg-gray-100; 21 | } 22 | 23 | @screen md { 24 | * { 25 | scrollbar-width: thin; 26 | scrollbar-color: theme(colors.gray.500) theme(colors.gray.100); 27 | } 28 | ::-webkit-scrollbar { 29 | width: 12px; 30 | } 31 | ::-webkit-scrollbar-track { 32 | background: theme(colors.gray.100); 33 | } 34 | ::-webkit-scrollbar-thumb { 35 | background-color: theme(colors.gray.500); 36 | border-radius: 6px; 37 | border: 3px solid theme(colors.gray.100); 38 | } 39 | } 40 | 41 | h1, h2, h3, h4, h5, h6 { 42 | @apply font-bold; 43 | } 44 | 45 | h1 { 46 | font-size: 1.75rem; 47 | } 48 | 49 | h2 { 50 | font-size: 1.5rem; 51 | } 52 | 53 | h3 { 54 | font-size: 1.25rem; 55 | } 56 | 57 | h4 { 58 | font-size: 1rem; 59 | } 60 | 61 | h5 { 62 | font-size: 0.75rem; 63 | } 64 | 65 | h6 { 66 | font-size: 0.5rem; 67 | } 68 | 69 | @screen md { 70 | h1 { 71 | font-size: 2.5rem; 72 | } 73 | h2 { 74 | font-size: 2rem; 75 | } 76 | h3 { 77 | font-size: 1.5rem; 78 | } 79 | h4 { 80 | font-size: 1.25rem; 81 | } 82 | h5 { 83 | font-size: 1rem; 84 | } 85 | h6 { 86 | font-size: 0.875rem; 87 | } 88 | } 89 | 90 | /* Input */ 91 | 92 | input:disabled, .disabled { 93 | @apply cursor-not-allowed bg-gray-200 text-gray-700; 94 | } 95 | 96 | /* Button */ 97 | 98 | button:focus { 99 | outline: none; 100 | } 101 | 102 | .btn { 103 | @apply inline-flex items-center justify-center text-sm font-semibold py-2 px-4 rounded-md cursor-pointer; 104 | } 105 | 106 | .btn:focus { 107 | @apply outline-none shadow-inner; 108 | } 109 | 110 | /* Button Styles */ 111 | 112 | .btn-subtle { 113 | @apply bg-gray-200 text-gray-800; 114 | } 115 | 116 | .btn-subtle:hover { 117 | @apply bg-gray-300 text-gray-900; 118 | } 119 | 120 | .btn-subtle:focus { 121 | @apply bg-gray-400 text-gray-900; 122 | } 123 | 124 | .btn-success { 125 | @apply bg-green-500 text-white; 126 | background-image: linear-gradient( 135deg, rgba(72, 187, 120, 1) 0%, rgba(56, 161, 105, 1) 100%); 127 | } 128 | 129 | .btn-success:hover { 130 | @apply bg-green-600; 131 | background-image: linear-gradient( 135deg, rgba(56, 161, 105, 1) 0%, rgba(47, 133, 90, 1) 100%); 132 | } 133 | 134 | .btn-success:focus { 135 | @apply bg-green-800; 136 | background-image: none; 137 | } 138 | 139 | .btn-warning { 140 | @apply bg-yellow-500 text-white; 141 | background-image: linear-gradient( 135deg, rgba(237, 137, 54, 1) 0%, rgba(221, 107, 32, 1) 100%); 142 | } 143 | 144 | .btn-warning:hover { 145 | @apply bg-yellow-600; 146 | background-image: linear-gradient( 135deg, rgba(221, 107, 32, 1) 0%, rgba(192, 86, 33, 1) 100%); 147 | } 148 | 149 | .btn-warning:focus { 150 | @apply bg-yellow-800; 151 | background-image: none; 152 | } 153 | 154 | .btn-danger { 155 | @apply bg-red-500 text-white; 156 | background-image: linear-gradient( 135deg, rgba(245, 101, 101, 1) 0%, rgba(229, 62, 62, 1) 100%); 157 | } 158 | 159 | .btn-danger:hover { 160 | @apply bg-red-600; 161 | background-image: linear-gradient( 135deg, rgba(229, 62, 62, 1) 0%, rgba(197, 48, 48, 1) 100%); 162 | } 163 | 164 | .btn-danger:focus { 165 | @apply bg-red-800; 166 | background-image: none; 167 | } 168 | 169 | button:disabled, .disabled { 170 | @apply cursor-not-allowed bg-gray-300 text-gray-500 shadow-none border-transparent; 171 | background-image: none; 172 | } 173 | 174 | button:disabled:hover, .disabled:hover, button:disabled:focus, .disabled:focus { 175 | @apply bg-gray-300 text-gray-500 border-transparent shadow-none; 176 | background-image: none; 177 | } 178 | 179 | .btn-normal { 180 | @apply py-1 px-4 text-sm; 181 | } 182 | 183 | .btn-large { 184 | @apply py-2 px-5 text-base; 185 | } 186 | 187 | .button-xl { 188 | @apply py-2 px-5 text-base; 189 | } 190 | -------------------------------------------------------------------------------- /src/components/Home.re: -------------------------------------------------------------------------------- 1 | let str = React.string; 2 | [%bs.raw {|require("./Home.css")|}]; 3 | let logo: string = [%raw "require('../assets/coronaSafeLogo.svg')"]; 4 | let github_logo: string = [%raw "require('../assets/github.svg')"]; 5 | 6 | let json = [%bs.raw {|require("./data.json")|}]; 7 | let data = json |> Data.makeData; 8 | 9 | let showHome = quiz => { 10 |
11 | {quiz 12 | |> Array.map(q => 13 |
14 |
16 |
17 |

{q |> Quiz.title |> str}

18 |

19 | {q |> Quiz.description |> str} 20 |

21 |
22 |
23 | 30 |
31 |
32 |
33 | ) 34 | |> React.array} 35 |
; 36 | }; 37 | 38 | let showQuiz = (path, quiz, questionNoStr) => { 39 | let questionNo = Url.Quiz.parse(questionNoStr); 40 | switch (quiz |> Quiz.findOpt(path), questionNo) { 41 | | (Some(quiz), Some(questionNo)) => 42 | 43 | | _ => showHome(quiz |> Quiz.default) 44 | }; 45 | }; 46 | 47 | [@react.component] 48 | let make = () => { 49 | let url = ReasonReactRouter.useUrl(); 50 | let quiz = data |> Data.quiz; 51 |
52 | /* Header */ 53 | 54 |
55 |
56 | 72 |
73 |
74 | /* Quiz cards */ 75 |
76 |
78 | ReasonReactRouter.replace("/english")} 80 | className="home-langualge-filter__link hover:text-gray-900 hover:border-gray-900 "> 81 | {"English" |> str} 82 | 83 | ReasonReactRouter.replace("/malayalam")} 85 | className="home-langualge-filter__link hover:text-gray-900 hover:border-gray-900 "> 86 | {{j|മലയാളം|j} |> str} 87 | 88 | ReasonReactRouter.replace("/french")} 90 | className="home-langualge-filter__link hover:text-gray-900 hover:border-gray-900 "> 91 | {{j|Français|j} |> str} 92 | 93 | ReasonReactRouter.replace("/urdu")} 95 | className="home-langualge-filter__link hover:text-gray-900 hover:border-gray-900 "> 96 | {{j|اردو|j} |> str} 97 | 98 | ReasonReactRouter.replace("/kannada")} 100 | className="home-langualge-filter__link hover:text-gray-900 hover:border-gray-900 "> 101 | {{j|ಕನ್ನಡ|j} |> str} 102 | 103 |
104 | {switch (url.path) { 105 | | ["malayalam"] => showHome(quiz |> Quiz.filterByLang("malayalam")) 106 | | ["english"] => showHome(quiz |> Quiz.filterByLang("english")) 107 | | ["french"] => showHome(quiz |> Quiz.filterByLang("french")) 108 | | ["urdu"] => showHome(quiz |> Quiz.filterByLang("urdu")) 109 | | ["kannada"] => showHome(quiz |> Quiz.filterByLang("kannada")) 110 | | [baseUrl, questionNo] => showQuiz(baseUrl, quiz, questionNo) 111 | | _ => showHome(quiz |> Quiz.default) 112 | }} 113 |
114 | /* Footer */ 115 | 135 |
; 136 | }; 137 | -------------------------------------------------------------------------------- /src/components/QuizComponent.re: -------------------------------------------------------------------------------- 1 | let str = React.string; 2 | [%bs.raw {|require("./QuizComponent.css")|}]; 3 | 4 | type page = 5 | | Quiz 6 | | Complete; 7 | 8 | type state = { 9 | page, 10 | selectedAnswer: option(Answer.t), 11 | }; 12 | 13 | let updateAnswer = (setState, answer, _event) => { 14 | setState(state => {...state, selectedAnswer: Some(answer)}); 15 | }; 16 | 17 | let showSelectedAnswer = state => { 18 | switch (state.selectedAnswer) { 19 | | Some(answer) => 20 |
21 |

Answer.correctAnswer ? "text-green-600" : "text-red-600" 26 | ) 27 | }> 28 | {answer |> Answer.title |> str} 29 |

30 |
31 | {answer 32 | |> Answer.description 33 | |> Array.mapi((index, d) => 34 |

string_of_int}> 35 | {d |> str} 36 |

37 | ) 38 | |> React.array} 39 |
40 |
41 | {switch (answer |> Answer.youtubeUrl) { 42 | | Some(src) => 43 |
45 |