system-media
TypeScript icon, indicating that this package has built-in type declarations

1.2.0 • Public • Published

Welcome to system-media 👋

npm version License: MIT

A React utility library to match your props to the given media query

🏠 Homepage

Install

npm install system-media

Usage

Codesandbox Link:

https://codesandbox.io/s/crazy-zhukovsky-u18zw

import React from 'react';
 
import { system } from 'system-media';
 
const theme = {
  // Default breakpoints used by styled-system
  breakpoints: ['40em', '52em', '64em'],
};
 
const Text = ({ value }) => (
  <p
    style={{
      fontFamily: 'comic-sans',
      fontSize: '16px',
    }}
  >
    {system(theme.breakpoints)(value)}
  </p>
);
 
export default function App() {
  const user = 'Dan Abramov';
  const userDisplayNameMobile = user.split(' ')[0];
  const userDisplayNameDesktop = user;
  return (
    <div className="App">
      <Text
        value={[`Hi ${userDisplayNameMobile}`, `Hi ${userDisplayNameDesktop}`]}
      />
    </div>
  );
}

Author

👤 JM Santos johmichaelubas.santos@gmail.com

🤝 Contributing

Contributions, issues and feature requests are welcome!

Feel free to check issues page.

Show your support

Give a ⭐️ if this project helped you!

Package Sidebar

Install

npm i system-media

Weekly Downloads

1

Version

1.2.0

License

ISC

Unpacked Size

8.31 kB

Total Files

14

Last publish

Collaborators

  • jmaicaaan