Closed mjackson closed 7 years ago
Hmm, I'm not immediately excited about it, I prefer just doing a general "phone-ish" size in portrait, "phone-ish" size landscape, and then "desktop-ish". Designing to exact sizes makes me nervous. What does it do on the phone that comes out next month?
How about exporting strings under react-media/presets
?
Someone suggested on Twitter that we could have components for e.g.
yeah, I like Phone, Tablet, but strings might be good enough? Motion doesn't export "Wobbly" but rather presets.wobbly.
Agree, could be a very nice API. How would it compose though? with exporting strings, you could just:
import Media from 'react-media';
import { PHONE, TABLET } from 'react-media/presets';
export default () => ({
<Media query={`${PHONE} or ${TABLET}`}>
{matches => `Phone or tablet!`}
</Media>
});
You could even use these as primitives to base the "prefab" components on then.
Thought: could an actively maintained set of device-specific and device-class (phone, tablet, desktop) queries serve as the backbone of this project, in the same vein that history is for react-router
?
we send strings to matchMedia, that's the "history" part here I think.
You're right, but what I meant was "something that could be abstracted away and could serve other projects / the greater community".
Ah, yes. Strings seems to be the obvious choice for composition here. The hardest part left is deciding what the actual queries should look like. Are there any broadly recommended "phone" or "tablet" media queries out there?
Few notes: 1) Love the idea, of a presets file. Would love to see it as landscape and portrait since they are so different. 2) Chrome has pre-defined in their dev tools and appear to be close adaptions of the bootstrap media queries.
@kwelch I poked around in Chrome's DevTools but couldn't get the queries they're using. Do you see them?
If you switch the dropdown to Responsive
then, the predefined widths show up.
There is more granular than I think is appropriate for this library (at this point), but could give a decent MVP.
Looks like this conversation stalled. Closing.
Would it be useful for us to provide pre-configured queries for common devices? If so, what would be the best way to expose it?
The folks over at @CSS-Tricks have compiled a nice list of media queries for standard devices that I thought we could start with. Maybe we could provide a bunch of pre-configured
<Media>
components that target these devices.@ryanflorence Thoughts?