Coder Social home page Coder Social logo

teamwertarbyte / material-ui-rating Goto Github PK

View Code? Open in Web Editor NEW
88.0 3.0 35.0 784 KB

Rate something with style.

Home Page: https://mui.wertarbyte.com/#material-ui-rating

License: MIT License

JavaScript 100.00%
material-ui react material-design rating-stars rating

material-ui-rating's People

Contributors

davejm avatar goferito avatar goldylucks avatar goodsted-dev avatar greenkeeper[bot] avatar jmcneese avatar lemaik avatar lisa-tw avatar ogbeche77 avatar oliviertassinari avatar petero-dk avatar saschb2b avatar tyanas avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

material-ui-rating's Issues

Support for half-stars

This is a feature request.
Some other star rating components have ability to render rating to half-star precision, like so:
example

It would be nice to have this ability together with material-ui integration in one component.

Starts are still buttons in readOnly

Then, if the style is changed to have the stars smaller and closer to each other (because they don't need to be clicked, and look better in the design), google's test will consider that those button elements are too close, and the page is not mobile friendly.

Missing Dependency: classnames

material-ui-rating depends on the classnames package but it's not listed as a dependency in package.json. Unless I'm missing something it should be added.

Errors with Material UI V 1.4.3

I have the problem ./node_modules/material-ui-rating/lib/components/Rating/Rating.js Module not found: Can't resolve 'material-ui/IconButton' in I changed some lines on Rating.js (updated material-ui calls to @material-ui/core/) and then a new error comes:
TypeError: Cannot read property 'orange500' of undefined

I'm using material-ui-rating V 2.0.0

disable hover effect

It would be great to be able to disable the hover effect. Is there a way to achieve this now? If not, I'd be happy to create a pull request.

onChange() never triggered

I'm using this with webpack and material-ui and the component shows up, the max and value properties work as expected, but the onChange function is never triggered. I have tried on Firefox and Chrome for Ubuntu.

Warning: React does not recognize the `iconHovered` prop on a DOM element

See image below.

# cat client/node_modules/material-ui-rating/package.json | grep version      
"version": "4.1.0",
Here's my Rating component, there's no `iconHovered` in there
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import MuiRating from 'material-ui-rating'
import { withStyles } from '@material-ui/core'

class Rating extends Component {
  static propTypes = {
    classes: PropTypes.object.isRequired,
    value: PropTypes.number.isRequired,
    muiRatingClasses: PropTypes.object,
    readOnly: PropTypes.bool,
  }

  static defaultProps = {
    muiRatingClasses: {},
    readOnly: true,
  }

  render() {
    const {
      classes,
      value,
      muiRatingClasses,
      readOnly,
      ...restOfProps
    } = this.props
    return (
      <MuiRating
        classes={{
          root: classes.starsRoot,
          icon: classes.star,
          iconButton: classes.starButton,
          ...muiRatingClasses,
        }}
        value={value}
        readOnly
        {...restOfProps}
      />
    )
  }
}

const HEIGHT = 20

const styles = () => ({
  starsRoot: {
    display: 'flex',
    alignItems: 'center',
    height: HEIGHT,
  },
  starButton: {
    padding: 0,
    margin: 0,
    transform: 'scaleX(-1)',
    '& > span': {
      height: HEIGHT,
    },
  },
  star: {
    height: HEIGHT,
    width: 16,
  },
})

export default withStyles(styles)(Rating)

can you look into it? thanks!

image

PR - pass component as props

following the MUI conventions, I'd like to pass <Rating component="span" />

I have a use case in which <Rating /> is nested within a <p /> element, and I get a dom violation.

Shall I prepare a PR?

I can also add an example in Rating.md, and for story book I'd love some guidance since I've never done that before.

PR - prettier / eslint

while working on #28 accidentally formatted many of the files automatically through prettier. I see there's no prettier nor eslint in the project. I can add it with the config of your choice, i.e. semistandard.

I think it will make it easier to maintain/extend.

Thoughts?

Build don't have index.d.ts

After add file of type index.d.ts, the file all the same don't send in package. I think problem in system build.
Maybe can you use tsdx with great support typescript?

PR - rtl support

I actually do this already in my project by setting transform: 'translateX(180deg)'. I can PR here it here as well :)

whether you will add "Half ratings, sizes, and accessibility" functionality to the library?

I wanted to use your library as a customizable solution because our design expects it, and we cannot use the original package from the material ui library.
And so I created the component based on this file but with fixing type and re-work from Classic React Component to Functional Component, maybe it help to use in future, but I can't use it without the above mentioned functionality. =(
https://github.com/TeamWertarbyte/material-ui-rating/blob/master/src/components/Rating/Rating.js

Link to the library with hooks
https://drive.google.com/file/d/1jVOePLPnqDwnzofa7BCIBgOve099SNKf/view?usp=sharing

PS: I mean full support how the original component does it
https://material-ui.com/api/rating/#rating-api

Half star rating icon off center

I added a rating in my react project with precision set to 0.5. "averageRating" is a state that is evaluated on render. Image shows how the star is a bit off. Did I do anything wrong or is this a bug?

image

<Rating precision={0.5} name="averageRating" value={averageRating} />

react warning: nativeColor prop

hey guys great job with the package!

I'm using react 16.8.6 and I'm getting a warning (attached console screenshot). I'm PRing a fix, let me know if it's ok :)

image

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.