This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, { useState } from 'react'; | |
| import { | |
| Navigate, | |
| RouterProvider, | |
| createBrowserRouter, | |
| } from 'react-router-dom'; | |
| import Cart from './components/Cart'; | |
| import Home from './components/Home'; | |
| import Login from './components/Login'; | |
| import Orders from './components/Orders'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const validateEmail = email => /^[^@ ]+@[^@ ]+\.[^@ \.]+$/.test(email); | |
| const isValidEmail = value => validateEmail(value) || 'Please enter a valid email address.'; | |
| let isValid = isValidEmail('abc@gmail.com'); | |
| console.log(isValid); // true | |
| isValid = isValidEmail('abc@@gmail.com'); | |
| console.log(isValid); // Please enter a valid email address |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // add all the elements inside modal which you want to make focusable | |
| const focusableElements = | |
| 'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'; | |
| const modal = document.querySelector('#exampleModal'); // select the modal by it's id | |
| const firstFocusableElement = modal.querySelectorAll(focusableElements)[0]; // get first element to be focused inside modal | |
| const focusableContent = modal.querySelectorAll(focusableElements); | |
| const lastFocusableElement = focusableContent[focusableContent.length - 1]; // get last element to be focused inside modal | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| body { | |
| font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, | |
| Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif; | |
| font-size: 20px; | |
| width: 60%; | |
| margin: 10px auto; | |
| } | |
| .errorMsg { | |
| max-width: 350px; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const topics = [ | |
| { | |
| id: 1, | |
| title: "Basic JavaScript", | |
| slug: "basic-javascript", | |
| subTopics: [ | |
| { | |
| id: 1, | |
| title: "JavaScript Operators", | |
| slug: "javascript-operators" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Section 1 | |
| const serverless = require('serverless-http'); | |
| const express = require('express'); | |
| const axios = require('axios'); | |
| const path = require('path'); | |
| const router = express.Router(); | |
| // Section 2 | |
| const app = express(); | |
| app.use(express.static(path.join(__dirname, '..', 'public'))); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [ | |
| { | |
| "name": "Margherita", | |
| "category": "Pizza", | |
| "image": "https://res.cloudinary.com/dyatqxvue/image/upload/v1622453419/margherita_5cdac6ceb6.jpg" | |
| }, | |
| { | |
| "name": "Double Cheese Margherita", | |
| "category": "Pizza", | |
| "image": "https://res.cloudinary.com/dyatqxvue/image/upload/v1622453443/double_cheese_margherita_9e5ff8f006.jpg" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React from "react"; | |
| import ReactDOM from "react-dom"; | |
| const AddItemForm = props => ( | |
| <form onSubmit={props.handleAddItem}> | |
| <input | |
| type="text" | |
| name="text" | |
| placeholder="Enter some value" | |
| autoComplete="off" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $body-color: #949ca5; | |
| $default-padding: 2rem; | |
| * { | |
| margin: 0; | |
| padding: 0; | |
| box-sizing: border-box; | |
| } | |
| html { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [ | |
| { | |
| "name": "Capsicum", | |
| "_id": "608c43a5f9b60c077d566e74", | |
| "Toppings": "Capsicum", | |
| "published_at": "2021-04-30T17:51:37.192Z", | |
| "createdAt": "2021-04-30T17:51:33.225Z", | |
| "updatedAt": "2021-05-02T09:16:59.480Z", | |
| "__v": 0, | |
| "price": 1.2, |
NewerOlder