Git Product home page Git Product logo

Comments (3)

phong-steph avatar phong-steph commented on May 20, 2024

I found a quick fix in this file:
Instead of pushing all differentes states for one input, push only one state for one input (ordered by priority).

from:

        if (field.hasErrors()) states.push('hasErrors');
        if (field.hasWarnings()) states.push('hasWarnings');
        if (field.hasInfos()) states.push('hasInfos');
        if (field.isValid()) states.push('isValid');

to:

        if (field.hasErrors()) states.push('hasErrors');
        else if (field.hasWarnings()) states.push('hasWarnings');
        else if (field.hasInfos()) states.push('hasInfos');
        else if (field.isValid()) states.push('isValid');

result:
image

PS: 'is-valid'class is not added if input has errors, warnings or infos

from react-form-with-constraints.

tkrotoff avatar tkrotoff commented on May 20, 2024

Sorry for the delay, I'm AFK until mid december.

An input can have warnings and/or infos and still be valid. Ce n'est pas exclusif.
hasErrors state is the only invalid state, others (info, warning) are considered valid. You can override the CSS if you want a different styling.

Here the related Sass code source: https://github.com/tkrotoff/react-form-with-constraints/blob/v0.14.0/packages/react-form-with-constraints-bootstrap4/scss/bootstrap.scss#L143-L150

Je pense que dans ton exemple le "wording" des feedbacks n'est pas le bon et devrait être :

  • hasErrors/invalid CSS class : "Cette information est incorrecte"
  • hasWarnings/warning CSS class : "Vérifiez cette information, elle semble/est peut être incorrecte"
  • hasInfos/info CSS class : "pour information blabla"

from react-form-with-constraints.

phong-steph avatar phong-steph commented on May 20, 2024

Overriding CSS will be the easiest solution thx!

from react-form-with-constraints.

Related Issues (20)

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.