Skip to content

Commit 9961ebc

Browse files
committed
Fix Storybook README badges
1 parent c8a9566 commit 9961ebc

4 files changed

Lines changed: 17 additions & 163 deletions

File tree

‎README.md‎

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# react-intersection-observer
22

3-
[![Version Badge][npm-version-svg]][package-url]
4-
[![Test][test-image]][test-url]
5-
[![License][license-image]][license-url]
6-
[![Downloads][downloads-image]][downloads-url]
3+
[![Version Badge](https://img.shields.io/npm/v/react-intersection-observer.svg)](https://npmjs.org/package/react-intersection-observer)
4+
[![Test](https://github.com/thebuilder/react-intersection-observer/workflows/Test/badge.svg)](https://github.com/thebuilder/react-intersection-observer/actions?query=workflow%3ATest)
5+
[![License](http://img.shields.io/npm/l/react-intersection-observer.svg)](LICENSE)
6+
[![Downloads](http://img.shields.io/npm/dm/react-intersection-observer.svg)](http://npm-stat.com/charts.html?package=react-intersection-observer)
77
![npm package minimized gzipped size](https://img.shields.io/bundlejs/size/react-intersection-observer?exports=InView%2C%20useOnInView%2C%20useInView&externals=react&format=both)
88

99
A React implementation of the [Intersection Observer API](https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API)
@@ -259,9 +259,9 @@ extend the `IntersectionObserverEntry` with the `isVisible` boolean.
259259
The `IntersectionObserver` itself is just a simple but powerful tool. Here's a
260260
few ideas for how you can use it.
261261
262-
- [Lazy image load](docs/Recipes.md#lazy-image-load)
263-
- [Trigger animations](docs/Recipes.md#trigger-animations)
264-
- [Track impressions](docs/Recipes.md#track-impressions) _(Google Analytics, Tag
262+
- [Lazy image load](apps/docs/docs/guides/recipes.mdx#lazy-image-loading)
263+
- [Trigger animations](apps/docs/docs/guides/recipes.mdx#scroll-triggered-animation)
264+
- [Track impressions](apps/docs/docs/guides/recipes.mdx#track-an-impression) _(Google Analytics, Tag
265265
Manager, etc.)_
266266
267267
## FAQ
@@ -375,7 +375,7 @@ globally, alongside either `jest.fn` or `vi.fn`.
375375
376376
See the instructions for [Vitest](#vitest). You should be able to use a similar
377377
setup/reset code, adapted to the testing library you are using. Failing that,
378-
copy the code from [test-utils.ts][test-utils-url], and make your own version.
378+
copy the code from [test-utils.ts](packages/react-intersection-observer/src/test-utils.ts), and make your own version.
379379
380380
### Fallback Behavior
381381
@@ -574,13 +574,3 @@ order to destroy the observer again.
574574
> You most likely won't need this, but it can be useful if you
575575
> need to handle IntersectionObservers outside React, or need full control over
576576
> how instances are created.
577-
578-
[package-url]: https://npmjs.org/package/react-intersection-observer
579-
[npm-version-svg]: https://img.shields.io/npm/v/react-intersection-observer.svg
580-
[license-image]: http://img.shields.io/npm/l/react-intersection-observer.svg
581-
[license-url]: LICENSE
582-
[downloads-image]: http://img.shields.io/npm/dm/react-intersection-observer.svg
583-
[downloads-url]: http://npm-stat.com/charts.html?package=react-intersection-observer
584-
[test-image]: https://github.com/thebuilder/react-intersection-observer/workflows/Test/badge.svg
585-
[test-url]: https://github.com/thebuilder/react-intersection-observer/actions?query=workflow%3ATest
586-
[test-utils-url]: https://github.com/thebuilder/react-intersection-observer/blob/master/src/test-utils.ts

‎apps/storybook/stories/Recipes.mdx‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Markdown } from '@storybook/addon-docs/blocks';
2-
import Recipes from '../../../docs/Recipes.md?raw';
2+
import { toStorybookMarkdown } from './recipe-markdown';
3+
import Recipes from '../../docs/docs/guides/recipes.mdx?raw';
34

4-
<Markdown>{Recipes}</Markdown>
5+
<Markdown>{toStorybookMarkdown(Recipes)}</Markdown>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
const frontmatter = /^---\r?\n[\s\S]*?\r?\n---\r?\n/;
2+
const observerDemo = /<ObserverDemo recipe="[^"]+" \/>/g;
3+
4+
export function toStorybookMarkdown(source: string) {
5+
return source.replace(frontmatter, "").replaceAll(observerDemo, "");
6+
}

‎docs/Recipes.md‎

Lines changed: 0 additions & 143 deletions
This file was deleted.

0 commit comments

Comments
 (0)