A React utility library to match your props to the given media query
🏠 Homepage
npm install system-media
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>
);
}
👤 JM Santos johmichaelubas.santos@gmail.com
- Website: https://github.com/jmaicaaan
- Github: @jmaicaaan
Contributions, issues and feature requests are welcome!
Feel free to check issues page.
Give a ⭐️ if this project helped you!