A React Navbar Component by Dan on CodePen

A simple, responsive #Navbar using #ReactJS:  @CodePen #Coding

  • I’m going to give it a name of NavComponent because that just makes way too much sense, and inside the render function, toss in an empty (for now) set of tags to wrap around everything else that will go in there: – – And underneath all that I’m going to…
  • This will give my a “hamburger” icon (courtesy of Font Awesome) for smaller screens that need a drop down menu.
  • Since our drop-down menu is contained in the “narrowLinks” className, we’re going to target that in our function: – – And then tell our function to toggle the drop-down based on its current CSS display value: – – And to make the new function work, we need to give our…
  • I obviously don’t want to see both sets of links all the time, and since we’re using mobile-first design, we’re going to set our “navWide” links to hidden: – – And we’re also going to stick our hamburger icon and drop-down links on the left side of the screen, just…
  • And finally a media query to switch between our mobile drop-down menu and our larger screen mode with just a row of our links: – – For a working example, click here.

I use React a lot, and I use navbars a lot, so this was just an obvious one for me. This is nothing extravagant. I’m not using React Router in this example, just some tags. But it is responsive, so that’s fun.
Continue reading “A React Navbar Component by Dan on CodePen”

contra/react-responsive — Media queries in react for responsive design #reactjs

contra/react-responsive 
 — Media queries in react for responsive design 

#reactjs

  • For a list of all possible shorthands and value types see numbers given as a shorthand will be expanded to px ( will become )

    You may also specify a function for the child of the MediaQuery component.

  • When the component renders, it is passed whether or not the given media query matches.
  • You may specify an optional property on the that indicates what component to wrap children with.
  • If the property is not defined and the has more than 1 child, a will be used as the “wrapper” component by default.
  • The values property can contain , , , , , , , , , , , and to be matched against the media query.

react-responsive – Media queries in react for responsive design
Continue reading “contra/react-responsive
— Media queries in react for responsive design

#reactjs”

A React Navbar Component by Dan on CodePen

A simple, responsive #Navbar using #ReactJS:  #Coding

  • I’m going to give it a name of NavComponent because that just makes way too much sense, and inside the render function, toss in an empty (for now) set of tags to wrap around everything else that will go in there:

    And underneath all that I’m going to render the component inside the tags in my index.html:

    Ok, so we have a basic component that renders an empty nav.

  • This will give my a “hamburger” icon (courtesy of Font Awesome) for smaller screens that need a drop down menu.
  • Since our drop-down menu is contained in the “narrowLinks” className, we’re going to target that in our function:

    And then tell our function to toggle the drop-down based on its current CSS display value:

    And to make the new function work, we need to give our and tags inside “navNarrow” an onClick:

    That just about wraps it up.

  • I obviously don’t want to see both sets of links all the time, and since we’re using mobile-first design, we’re going to set our “navWide” links to hidden:

    And we’re also going to stick our hamburger icon and drop-down links on the left side of the screen, just for funsies:

    So by setting our icon to float: left, that’s taken care of.

  • And finally a media query to switch between our mobile drop-down menu and our larger screen mode with just a row of our links:

    For a working example, click here.

I use React a lot, and I use navbars a lot, so this was just an obvious one for me. This is nothing extravagant. I’m not using React Router in this example, just some tags. But it is responsive, so that’s fun.
Continue reading “A React Navbar Component by Dan on CodePen”

Build a simple component to handle media queries in ReactJS — Boyney – Medium

The component behaves as a wrapper component for child components. Continue rea...  #react

  • The component behaves as a wrapper component for child components.
  • Using media queries and a wrapper component to handle media queries in ReactJS
  • So I explored using CSS and Wrapper Components to do something similar.
  • Never miss a story from ReactJS News , when you sign up for Medium.
  • #ReactJS and React Native Stories for JavaScript Web Architects, Builders, Ninjas and the like.

“Build a simple component to handle media queries in ReactJS — Boyney” is published by ReactJS News
Continue reading “Build a simple component to handle media queries in ReactJS — Boyney – Medium”