Random quote machine feedback using react

Random quote machine feedback using react
0

#1

Link - https://sxnaprkhr.github.io/random-quote-machine/
Code - https://github.com/sxnaprkhr/random-quote-machine

I didn’t add the background transition because I’ve still got to learn that ReactTransitions


#2

MY EYES!!! :confounded: You gotta change that color bud. Also would be nice if the box stayed the same size, the button keeps jumping away :slight_smile:


#3

You should also use pointer cursor for the button and clickable elements by using the cursor property in css.


#4

Seems to work nicely. I believe you could make the componentDidMount a little more concise if you wanted to.

  componentDidMount() {
    fetch(endpoint)
      .then(blob => blob.json())
      .then(({quotes}) =>
        this.setState({
          quotes
        }, this.randomQuote)
      )
      .catch(err => console.error(err));
  }

#5

@yousef_040 @ezfuse @RandellDawson
Yeah will change that minor css things for now but I wanted reviews about the actual javascript code if it was spaghetti or not.

The language percentage on github doesn’t show css percentage, anything wrong with that structure?


#6

Your code seems to be organized in my opinion.

I am not familar with language percentage on github, so I do not know how to answer this question.


#7

The design is pretty good. I’m really bad at CSS. How can you center the quote container vertically? Any good resources? I’ve read several articles for some issues I faced but I still don’t understand how alignment works so most of the time I only copied it. Should I re-learn CSS?

It seems the random algorithm is similar to me. It never gets the same quote consecutively, but in my app, sometimes I get the same quote. Does number of quotes available affect the randomness? Because I made my own array of quotes and there are only seven quotes.


#8

I was also in a similar situation as you are of now. I was really bad at CSS, like really BAD. The main reason was that I was moving way too fast in web development. I did all the important things that one must learn in CSS but never implemented many of them like I heard of flexbox and grid for alignment, learned them in a day but never used in any actual CSS code for alignment of different elements. I would say rather than learning from a ton of resources, start building something and then asking people for reviews like on this platform which is very good or on any slack groups. It would really help you.

For vertically centering the container, the CSS code is as follows:

.parent-div {
min-height:100vh;                //describing the min-height of the parent div
display:flex;                    //simply applying flexbox
flex-direction:column;           //setting flex-direction to be col
justify-content:center;          // aligning items on the main axis at center
align-items:center;              // aligning items on the axis other than main axis at the center which will make the child-div at the vertically and horizontally center
}