Skip to content

Commit 1f0d0e8

Browse files
committed
Add wrapper example back to the README
1 parent 5039343 commit 1f0d0e8

File tree

1 file changed

+20
-7
lines changed

1 file changed

+20
-7
lines changed

README.md

+20-7
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@
1313
<img src="https://media.giphy.com/media/l0Iyk4bAAjac3AU2k/giphy.gif" alt="Gif of the skeleton in action">
1414
</div>
1515

16-
Learn about the [changes in version 3](https://github.com/dvtng/react-loading-skeleton/releases/tag/v3.0.0), or view the [v2 documentation](https://github.com/dvtng/react-loading-skeleton/tree/v2#readme).
16+
Learn about the [changes in version
17+
3](https://github.com/dvtng/react-loading-skeleton/releases/tag/v3.0.0), or view
18+
the [v2
19+
documentation](https://github.com/dvtng/react-loading-skeleton/tree/v2#readme).
1720

1821
## Basic Usage
1922

@@ -75,7 +78,8 @@ This approach is beneficial because:
7578

7679
## Theming
7780

78-
Customize individual skeletons with props, or render a `SkeletonTheme` to style all skeletons below it in the React hierarchy:
81+
Customize individual skeletons with props, or render a `SkeletonTheme` to style
82+
all skeletons below it in the React hierarchy:
7983

8084
```tsx
8185
import Skeleton, { SkeletonTheme } from 'react-loading-skeleton'
@@ -233,7 +237,7 @@ return (
233237

234238
### Custom Wrapper
235239

236-
Wrapping a skeleton in a container is simple:
240+
There are two ways to wrap a skeleton in a container:
237241

238242
```tsx
239243
function Box({ children }: PropsWithChildren<unknown>) {
@@ -253,7 +257,11 @@ function Box({ children }: PropsWithChildren<unknown>) {
253257
)
254258
}
255259

256-
const wrapped = (
260+
// Method 1: Use the wrapper prop
261+
const wrapped1 = <Skeleton wrapper={Box} count={5} />
262+
263+
// Method 2: Do it "the normal way"
264+
const wrapped2 = (
257265
<Box>
258266
<Skeleton />
259267
</Box>
@@ -262,20 +270,25 @@ const wrapped = (
262270

263271
### The height of my container is off by a few pixels!
264272

265-
In the example below, the height of the `<div>` will be slightly larger than 30 even though the `react-loading-skeleton` element is exactly 30px.
273+
In the example below, the height of the `<div>` will be slightly larger than 30
274+
even though the `react-loading-skeleton` element is exactly 30px.
266275

267276
```tsx
268277
<div>
269278
<Skeleton height={30} />
270279
</div>
271280
```
272281

273-
This is a consequence of how `line-height` works in CSS. If you need the `<div>` to be exactly 30px tall, set its `line-height` to 1. [See here](https://github.com/dvtng/react-loading-skeleton/issues/23#issuecomment-939231878) for more details.
282+
This is a consequence of how `line-height` works in CSS. If you need the `<div>`
283+
to be exactly 30px tall, set its `line-height` to 1. [See
284+
here](https://github.com/dvtng/react-loading-skeleton/issues/23#issuecomment-939231878)
285+
for more details.
274286

275287
## Contributing
276288

277289
Contributions are welcome! See `CONTRIBUTING.md` to get started.
278290

279291
## Acknowledgements
280292

281-
Our logo is based off an image from [Font Awesome](https://fontawesome.com/license/free). Thanks!
293+
Our logo is based off an image from [Font
294+
Awesome](https://fontawesome.com/license/free). Thanks!

0 commit comments

Comments
 (0)