Skip to content

Commit

Permalink
Add additional code examples
Browse files Browse the repository at this point in the history
  • Loading branch information
damassi authored May 24, 2019
1 parent 1f1e391 commit d8f6f29
Showing 1 changed file with 32 additions and 1 deletion.
33 changes: 32 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,22 @@ one is expected to start at 0.
### MediaContextProvider

The `MediaContextProvider` component influences how `Media` components will be
rendered.
rendered. Mount it at the root of your component tree:

```tsx
// App.tsx

import React from "react"
import { MediaContextProvider } from "./Media"

export const App = () => {
return (
<MediaContextProvider>
...
</MediaContextProvider>
)
}
```

### Media

Expand All @@ -364,6 +379,22 @@ props that make up the API you’ll use to declare your responsive layouts. Thes
props all operate based on the named breakpoints that were provided when you
created the media components.

```tsx
// App.tsx

import React from "react"
import { Media } from "./Media"

export const HomePage = () => {
return (
<>
<Media at="xs">Hello mobile!</Media>
<Media greaterThan="xs">Hello desktop!</Media>
</>
)
}
```

The examples given for each prop use breakpoint definitions as defined in the
above ‘Setup’ section.

Expand Down

0 comments on commit d8f6f29

Please sign in to comment.