teleren/devto huggingface dataset:
A Simple React modal with good accessibility
Tags: modals
Published: 2023-10-21 12:51:50

---
title: A Simple React modal with good accessibility
published: true
date: 2023-10-21 00:37:00 UTC
tags: Modals
canonical_url: https://reactjsexample.com/a-simple-react-modal-with-good-accessibility/
---

# React Modal Easy

> ![A Simple React modal with good accessibility](https://reactjsexample.com/content/images/2023/10/Code_2023-10_11-32-52.jpg)
> 
> Simple modal with good accessibility

The purpose of this component is to provide a simple interface. You won’t find predefined styles to cause you problems or unnecessary customizations.

## Install

```
npm i react-modal-easy
```

## Usage

```
// include styles
import 'react-modal-easy/dist/style.css';

const [visible, setVisible] = useState(false);

return (
  <Modal isVisible={visible} onClose={() => setVisible(false)}>
    <div style={{ backgroundColor: 'white', width: 500, padding: 20 }}>
      <Modal.Title>React Modal Easy</Modal.Title>
      ...
    </div>
  </Modal>
);
```

![A Simple React modal with good accessibility](https://github.com/joalisonpereira/react-modal-easy/raw/master/docs/usage1.png)

## Acessibility

By internally using the [Radix Dialog](https://www.radix-ui.com/primitives/docs/components/dialog), this component comes with accessibility configurations by default. However, for the best use of this feature, also utilize the `Title`, `Description` and `Close` components.

```
...
return (
  <Modal
    isVisible={visible}
    onClose={onClose}
    closeButton={
      <Modal.Close onClick={onClose} aria-label='Close'>
        X
      </Modal.Close>
    }
  >
    <Modal.Title>Lorem Ipsum is simply</Modal.Title>
    <Modal.Description>
      Lorem Ipsum is simply dummy text of the printing and typesetting industry.
    </Modal.Description>
    ...
  </Modal>
);
```

## Props

| Property | Type | Default | Description |
| --- | --- | --- | --- |
| isVisible | boolean | | whether to show dialog |
| onClose | function | | handler called onClose of modal |
| animation? | ‘scale’ , ‘translate’ , ‘none’ | scale | animation type |
| closeButton? | React.ReactNode | Component | close component, use `null` to disable. |
| className? | string | | modal component class |
| overlayClassName? | string | | overlay component class |

## Components

| Name | Description |
| --- | --- |
| [Modal.Title](https://www.radix-ui.com/primitives/docs/components/dialog#title) | An accessible title to be announced when the dialog is opened. |
| [Modal.Description](https://www.radix-ui.com/primitives/docs/components/dialog#description) | An optional accessible description to be announced when the dialog is opened. |
| [Modal.Close](https://www.radix-ui.com/primitives/docs/components/dialog#close) | The button that closes the dialog. |

## GitHub

[View Github](https://github.com/joalisonpereira/react-modal-easy?ref=reactjsexample.com)
forEach: The infinite loop with boundaries.
Published: 2023-10-21 00:20:43

Wash...
     As in all things there is a beginning. How did it all start? Well, there was an array and an opportunity to access each individual elements of that array. A direction of which way to go.  
How often is it available? What are we to do with it? How can we effect each element? For loops allowed all this to happen. 
             for(let i=0;i<array.length;i++){
                  (start);(stop);(increment)
                ['What can we do with what we have?']
             }
     
...Are we there yet?

Rinse... 
     For whatever purpose you are trying to achieve with your code, the forEach method is to be used when all elements of an array must be accessed in ascending order. A higher-order function is a function that takes one or more functions as arguments, or returns a function as its result. For example, forEach is a higher-order function that takes a callback function and executes it once for each array element. Also, forEach is a method on the array itself, so it can be called on any array using the dot notation. Unlike most other higher-order functions, forEach does not return a new collection. Instead, it goes through the original collection and allows its items to be used in repetitive operations and tasks. The forEach() method returns "undefined". Whether you are adding them all together, multiplying, pushing them into a separate array, or passing a function that is executed on each element in the array.*****BUT, there is not a return value for this method.
              array.forEach(element => {output.push(element)}

Repeat...
     An excellent way to reduce bugs, is to use the forEach method. Because of scope ownership, the forEach method prevents contamination into other aspects of your code. Although, it is not a method that would be used for specialized application, it is very helpful in time management and less key strokes. The more that gets done with less amount of energy used has got to be better, right?

                   *Extra Credit-Sources*
              Mozilla - https://developer.mozilla.org
When To Use Enum in TypeScript
Tags: typescript, tutorial, beginners, learning
Published: 2023-10-21 00:07:48

Hey everyone,

I wrote an [insightful article](https://bluesockets.com/typescript/when-to-use-enum-in-typescript/) on when and how to use Enums in TypeScript.

Enums in TypeScript allow us to define a set of named constants. They are essentially a way to give more friendly names to sets of numeric values. Enums can be defined using the `enum` keyword.

I provide some great scenarios where Enums can be exceptionally useful:

1.**Representing States** - Enums are handy for representing different states in your application. For example, if you're working on a game, you might have states like Loading, Playing, Paused, and GameOver.

   ```typescript
   enum GameState { 
       Loading, 
       Playing, 
       Paused, 
       GameOver 
   }
   ```

2.**Days of the Week** - When working with days of the week, Enums can make your code more intuitive.

   ```typescript
   enum DayOfWeek { 
       Sunday, 
       Monday, 
       Tuesday, 
       Wednesday, 
       Thursday, 
       Friday, 
       Saturday 
   }
   ```

3.**Error Codes** - Enums can be perfect for handling error codes or statuses.

   ```typescript
   enum ErrorCode { 
       NotFound = 404, 
       Unauthorized = 401, 
       InternalServerError = 500, 
       BadRequest = 400 
   }
   ```

4.**User Roles** - Enums can define user roles in an application, which helps control access levels and permissions.

   ```typescript
   enum UserRole { 
       Admin, 
       Moderator, 
       User, 
       Guest 
   }
   ```

5.**Configuration Flags** - If your application has various configuration options, Enums can be used to represent them.

   ```typescript
   enum Configuration { 
       ShowHeader = 1, 
       ShowFooter = 2, 
       ShowSidebar = 4, 
       DarkMode = 8 
   }
   ```

The article also discusses the advantages of using Enums, including improved readability, maintainability, type safety, and intellisense support. It's definitely worth a read!

For more detailed explanations and code examples, you can check out the full article [here](https://bluesockets.com/typescript/when-to-use-enum-in-typescript/).
DevFest Flutter Local data storage using Drift Resources document
Tags: flutter, database
Published: 2023-10-21 00:01:57

tags:: #flutterMeetup #devfest #google/flutter #talks 
## Summary 
Local data storage for a Flutter project using Drift. Talk for WindyCity DevFest. 

## Resource Links

### technology documentation
* [Drift documentation ](https://drift.simonbinder.eu)
* [Drift package at pub.dev](https://pub.dev/packages/drift)
* [Riverpod autodispose documentation](https://riverpod.dev/docs/concepts/modifiers/auto_dispose)


### Project resources
* [Github repository for project](https://github.com/valerianaGit/FlutterDriftLocalDataStorageDemo)
* [SQLite docs](https://www.sqlite.org)
* [StreamBuilder vs StreamProvider](https://stackoverflow.com/questions/59737116/flutter-with-firestore-streambuilder-vs-streamprovider)

#### Packages used 
All these packages can be found at [pub.dev](https://pub.dev/packages)

##### Dependencies 
* drift: ^2.7.0
* sqlite3_flutter_libs: ^0.5.13
* path_provider: ^2.0.14
* path: ^1.8.2
* flutter_slidable: ^3.0.0
* drift_db_viewer: ^2.0.0
* flutter_riverpod: ^2.3.5
##### dev_dependencies:
* drift_dev: ^2.2.0+1
* build_runner: ^2.2.1


### Slides assets
* [QR code generator](https://qr.io)

## Recommended External Links
[Keeping it Local by Fitz](https://youtu.be/uCbHxLA9t9E?si=dX62-_Ryq3ZUdLPQ)

## Where to find me 
twitter - @valerianagit
instagram @valeriana.swift
dev.to @ valerianagit
[Join us at Flutter Chicago](https://www.meetup.com/flutter-chicago/)
[Join Flutteristas!](https://flutteristas.org)
What's Your Frog Today? Eat It and Tell Us About It!
Tags: discuss, codenewbie, beginner
Published: 2023-10-21 00:00:00

---
published_at : 2023-10-21 00:00 +0000
---
Have you heard of the "Eat the Frog" method? It urges you to dentify and tackle one important task right at the beginning of your day. This key task is often referred to as your "frog," symbolizing a challenging but necessary activity. 

So, here's the deal: We're curious about what your "frog" is for today. Take a bite, accomplish your task, and then come back to share your experience with us. Let's hear about your daily triumph over procrastination!

Follow the [CodeNewbie Org](https://dev.to/codenewbieteam) and [#codenewbie](https://dev.to/t/codenewbie) for more discussions and online camaraderie!

*{% embed* https://dev.to/codenewbieteam *%}*
Unveil Your App Secrets!
Tags: discuss
Published: 2023-10-21 00:00:00

---
published_at : 2023-10-21 00:00 +0000
---
Share your favorite apps, especially some of those lesser-known gems!

Follow the DEVteam for more discussions and online camaraderie!

{% embed [https://dev.to/devteam](https://dev.to/devteam) %}
Frontend Vs Backend: An Objective Look
Tags: frontend, backend, fullstack, softwareengineering
Published: 2023-10-20 23:29:52

_Image credit: [geeks for geeks](https://media.geeksforgeeks.org/wp-content/uploads/20190712131938/front-end-vs-back-end.png)_

I wrote a short post about how backend development is more critical than frontend development and shared it among a few friends and colleagues yesterday; that's just me being silly.

Today, I have decided to write a more abjective blog post about the debate. Without further ado, here's what I think.

## There are no Frontends Or Backends.

Yes, there are no frontends or backends. We only have software that runs on machines; any software can be a client or server at anytime. The end user is the only one who doesn't get to serve as a server. What do I mean?

Let's start at the very top of the stack

*The UI:* There are many kinds of UI, but in this instance, I'm talking about the web UI. Yes, it is a client to a web backend (say a RESTful API), but simultaneously a server for the end user.  But a RESTFUL API is also a client to a database server. 

It might surprise you that databases also have frontends and backends. Well, databases are as complex as operating systems, but to keep it as simple as possible, I'd say most databases contain two main parts:

**The Query Engine:** This is the front end of your database. It takes your query, plans execution,  and optimizes it when possible. The query engine then passes your question to the next component.

**The Storage Engine:** This is your database's backend. It takes the prepared query from the query engine and executes it(oversimplification). This layer handles data storage and retriever from disk, what gets stored in memory, scheduled database cleanups, etc. Of course, it achieves this by talking to the operating system, so we can accurately say that a database's storage engine is a client of the operating system. But wait a minute; the operating system also has a front and back end, namely, the userland and kernel, which are the front and back end of the operating system.

Well, by now, you get the gist. No matter what kind of software you choose to write, your software is serving and being served simultaneously.

## But which one is more complex?

I can tell you this: creating a database, a compiler, an operating system, and anything that directly talks to the hardware is always difficult. Every other thing is easy, but at scale, nothing is.

You could sort an array containing five items, but let's make that five billion items, and now you'd have to deal with all sorts of demons.

We are all software developers; some prefer to work on the top of the stack, while others prefer to work very close to the bottom. Whatever area you like to stay, ensure you're competent and can build software that works at various scales.
From Issue to Experience: My Journey Contributing to Curio
Published: 2023-10-20 23:25:41

There's an unwritten code among developers – when you spot an issue, you pitch in to resolve it. This story began similarly when my friend, @sdThaker, raised an issue on the [Curio project](https://github.com/Curio-org/Curio/issues/53).

## Discovering Curio

I had heard of Curio in passing conversations but hadn't dived deep into it. As any curious developer would, I took a cursory look at the open issues to see if there was anything I could assist with. 

This brings me to the day @sdThaker created an issue.

## The Unexpected Issue

Turns out, Curio had a slight hiccup. The logo on their interface, as familiar and inviting as it looked, did nothing when clicked. Most of us, knowingly or not, have the habit of clicking on the website's logo expecting it to take us back to the home page. In the realm of user experience, such a non-responsive element can be mildly frustrating.

When @sdThaker raised this issue, he suggested I give it a shot. The challenge, though simple, was a chance for me to contribute to an open-source project I liked. I saw it as a perfect opportunity to sharpen my skills while simultaneously bettering the project.

## The Fix

Without much ado, I forked the repo and set up the development environment. My solution was straightforward: wrap the Curio logo in `HeaderCurio` with React Router's `Link` component to make it responsive. This ensures that any time a user clicks on the logo, they're directed back to the home page.

Upon completing the changes and testing them thoroughly, I made a pull request ([#67](https://github.com/Curio-org/Curio/pull/67)) detailing the modifications.

## The Takeaway

This experience, as simple as it might sound, was incredibly fulfilling. Not only did I get the chance to contribute to an open-source project I believe in, but I also enjoyed the camaraderie that came from working alongside fellow developers, even if virtually.

To anyone hesitant about diving into the open-source community, remember that every contribution, no matter how small, makes a difference. In my case, the nudge from @sdThaker made all the difference.

Cheers to coding, collaboration, and the continuous journey of learning!
Optimizing Web Performance: PNG Compression⚡
Tags: webdev, frontend, react, codenewbie
Published: 2023-10-20 23:13:09

When I recently opened my [personal website](https://patricklisiecki.com/) on a slower Internet connection than usual, I noticed that certain images wouldn't load in automatically. If I scrolled too fast, then the images would be invisible or just start to render. I quickly realized that this would lead to an unpleasant and awkward experience for anybody that may visit my site, as certain sections would simply be blank or half there. It didn't take long to pinpoint the issue, as one look at the network activity in the dev tools showed me everything that I had to know.


![Network Activity 1](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zter3t6l4554knkti6os.png)

The icons and images I was using for my personal website came from an open source [3D icons library](https://3dicons.co/). The icons are high resolution and extremely detailed. I didn't originally consider the size of these icons, however, as you can see from the network activity, each icon was a few megabytes. Add a couple more icons and now the web browser is downloading around **38 megabytes** of resources just to render the website as intended.

After realizing how much time it took to fully download all of the resources on my current Internet connection, it became obvious that I had to speed up the load time of my site. I utilized [TinyPNG](https://tinypng.com/), a website meant for compressing WebP, PNG, and JPEG images. After compressing all of my icons, I was able to get the size of each image down by an average of **80%**. After replacing the images, I checked the network activity once again.


![Network Activity 2](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q5ggenqttexpa0xk7bsk.png)

The load time of my website improved significantly and to my surprise, the image quality looked exactly the same. Each image was now **below 1 megabyte** resulting in a **total of 10 megabytes** across all the resources necessary for my website.

There are more methods that I plan on looking into when it comes to optimizing my website performance. One being utilizing the WebP format rather than PNG. The issue with this method is that some older versions of browsers may not support WebP yet, however, there are solutions to switch between WebP and PNG depending on browser compatibility. Then, there is lazy loading which is a technique commonly used for only initializing the images when its necessary. For example, the images that I utilize for my contact section at the bottom of my website wouldn't be initialized until a visitor would scroll to that section.

This is a very simple way to speed up load times and I wish that I had recognized this sooner, hopefully this can help someone else as well.
Setting Sail with a CMS called 'Wagtail'
Tags: wagtail, django, python
Published: 2023-10-20 22:40:51

![sailing ship](https://media.giphy.com/media/3rlkI1QFJWRUsdRtha/giphy.gif)

[Wagtail](https://wagtail.org/) is an open source Content Management System built off Django. It also happens to be the project I gave a shot at, during the [Outreachy](https://www.outreachy.org/) 2023 October contribution phase. Wagtail is my first ever experience with contributing to open source, and here are a couple of things I have learned so far:

- There's a whole lot more to git than pushing, pulling, and committing. One of the first things I learned from the mentors was how to **rebase** my commits into more logical units.
- I have learned about setting remotes for my git repositories for different purposes.
- There is value in good communication. Your problems get solved quicker when people understand you better.
- If you can reproduce problems that other people face, you can probably fix them too.
- It's important to be thorough with documentation. Documentation has the answers almost all the time.
- Automated tests are the backbone of every good project. The more the merrier. They are also exciting to write.
- There's never a need to go all the way alone. Allow people to help you, and also try your best to help people. That's the whole point of it all.
- Do not neglect the basics. A good understanding of simpler concepts helps. When you get stuck, strip down your problems to the basics, and you might find your solution there.
- It's okay to feel overwhelmed. Everyone gets this feeling. Getting started is often the hardest part. Soon after that, you'd find yourself finishing.
- Remember your 'why'. Your reason for contributing to open source is like a lamplight for when it gets dark. Periodically remind yourself of your 'why'.
- Persistence pays off. I've spent countless hours on problems and issues, but I keep knocking till I get answers. And you bet I will!
- People help because they want to, not because it's an entitlement of yours. Being nice and respectful is desirable in open-source communities.
- If any task looks or feels boring, it's because you haven't yet found a way to make it fun. Always try and have some fun, and you'll find yourself doing more.
- Write more. Seriously, write more.

With each passing day, I learn more useful things that I may not have learned while working on solo projects. I am subsequently going to write more on some of these individual lessons. For now, though, I'll keep it brief so I can get back to contributing 😁. I'm grateful for where I've gotten so far, and I cannot wait to see where this voyage takes me. 

Thank you for taking the time to read this. I hope you received some motivation to contribute to open source. And if you're already doing that, I hope this post brought back some good memories of your first time at it. 

Cheers.
CRYPTO RECOVERY CONTACT - WIZARD WEB RECOVERY
Published: 2023-10-20 22:29:59

The process of recovering lost Bitcoin can be a daunting task, but with the help of a reputable cryptocurrency recovery company WIZARD WEB RECOVERY, it can be made much easier. The first step in the process is usually an initial consultation and assessment of the situation. During this consultation, the recovery company will gather information about the lost Bitcoin, including the amount, the circumstances surrounding the loss, and any relevant transaction details. This information will be used to determine the best course of action for recovering the lost Bitcoin. Once the recovery company has gathered all the necessary information, they will begin using advanced techniques and tools to recover the lost Bitcoin. These techniques may include blockchain analysis, forensic investigation, and other specialized methods. The recovery company will work tirelessly to track down the lost Bitcoin and retrieve it for the client. This process may take some time, but regular updates and communication throughout the recovery process are essential. The recovery company should keep the client informed of any progress or setbacks and provide updates on the status of the recovery effort. In conclusion, recovering lost Bitcoin is a challenging process, but it is not impossible with the help of a reputable cryptocurrency recovery company like WIZARD WEB RECOVERY, if you wish to explore more about them kindly explore (wizardwebrecovery) and communicate with them through  live chat features.