Git Product home page Git Product logo

myreusable's Introduction

Introduction

Welcome to MyReusable, an open-source codes designed to save developers time by providing reusable hooks, components, and utilities. The primary goal of this project is to minimize bundle size and dependencies in your projects while providing a foundation that can be easily customized to meet your specific needs. Think of it as a toolkit โ€“ a set of raw, copy-friendly code snippets that empower you to tailor the functionality to your project requirements.

Feel free to explore, copy, and adapt the code snippets from MyReusable to enhance your development workflow. This project is here to save you time and offer flexibility in building applications. Happy coding!

-) ADDITIONAL TIPS & TRICK

Card List Layout (prevent last line growing)

      <ul className="flex flex-wrap justify-center gap-8 lg:after:content-[''] lg:after:flex-[1_0_31%]">
      <li className="shadow-lg flex-[1_0_48%] lg:flex-[1_0_31%]">Card</li>
      </ul>

One issue arises when you have three or more columns with two empty spaces: the last child will start growing. If you truly need to prevent this, you may want to consider referring to the layout used by YouTube. Here's a summary of the YouTube list layout:

(li) has a style width of calc(100% / var(--items-per-row) - var(--item-margin) - .01px).

(ul) has a style width of 100% with a flex.

This layout might offer a solution to your problem.

Implement Input Number

                    <Input
                      inputMode="numeric"
                      pattern="[0-9]*"
                      onChange={(e) => {
                        field.onChange(e.target.value.replace(/\D/, ""));
                      }}
                    />

The issue with this approach is that the user can still use the "paste" to enter string values. This can be avoided by using zod as follows:

phone_number: z
    .union([z.string(), z.number()])
    .default("")
    .refine((val) => /^[1-9]\d*$/.test(String(val)), {
      message: "*Should be a valid number",
    }),

myreusable's People

Contributors

damarwendha avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.