Skip to content

Instantly share code, notes, and snippets.

@RishikeshVedpathak
Created February 29, 2020 16:16
Show Gist options
  • Select an option

  • Save RishikeshVedpathak/507976713ac896b979e12b80854cd635 to your computer and use it in GitHub Desktop.

Select an option

Save RishikeshVedpathak/507976713ac896b979e12b80854cd635 to your computer and use it in GitHub Desktop.
import React from "react";
import withResponsive from "../../hoc/responsive";
const Home = (props) => {
const Yes = () => <span style={{ color: "#5cb85c" }}>YES</span>;
const No = () => <span style={{ color: "#d9534f" }}>NO</span>;
return (
<>
<div>
Is Desktop : {props.responsiveInfo.isDesktop ? <Yes /> : <No />}
</div>
<div>
Is Tablet : {props.responsiveInfo.isTablet ? <Yes /> : <No />}
</div>
<div>
Is Mobile : {props.responsiveInfo.isMobile ? <Yes /> : <No />}
</div>
<div>
Is Not Mobile : {props.responsiveInfo.isNotMobile ? <Yes /> : <No />}
</div>
<div>
Is Portrait : {props.responsiveInfo.isPortrait ? <Yes /> : <No />}
</div>
<div>
Is Retina : {props.responsiveInfo.isRetina ? <Yes /> : <No />}
</div>
</>
)
}
export default withResponsive(Home);
@angiecortez
Copy link
Copy Markdown

Hi, did you try with styled-components, it doesn´t work for me when i reload the page

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment