Skip to content

Commit

Permalink
fix: docusaurus internal code formatting (#122)
Browse files Browse the repository at this point in the history
- Fix issue described in: FormidableLabs/react-live#403
- Reverted most of the changes of a1f64f7
- Added a new React 19 hint to the use hook
  • Loading branch information
FleetAdmiralJakob authored Dec 10, 2024
1 parent 4c85344 commit 8b0af60
Show file tree
Hide file tree
Showing 107 changed files with 296 additions and 207 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function Demo() {
{error && <p>Error: {error.message}</p>}
</div>
);
}
};

```

Expand Down
3 changes: 1 addition & 2 deletions packages/website-docusaurus/docs/browser/useClipboard.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ Copy text to a user's clipboard
## Usage

```tsx live

function Demo() {
const [value, setValue] = useState("");
const [text, copy] = useClipboard();
Expand All @@ -30,7 +29,7 @@ function Demo() {
<button onClick={() => copy(value)}>Copy</button>
</div>
);
}
};

```

Expand Down
5 changes: 2 additions & 3 deletions packages/website-docusaurus/docs/browser/useCssVar.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ Manipulate CSS variables
## Usage

```tsx live

function Demo() {
const key = "--color";
const ref = useRef<HTMLDivElement>(null);
Expand All @@ -32,8 +31,8 @@ function Demo() {
<button onClick={switchColor}>Change Color</button>
</section>
);
}
};

```

%%API%%
%%API%%
2 changes: 1 addition & 1 deletion packages/website-docusaurus/docs/browser/useDarkMode.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ function Demo() {
</div>
</div>
);
}
};

```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function Demo() {
const { pixelRatio } = useDevicePixelRatio();

return <p>Device pixel ratio: {pixelRatio}</p>;
}
};

```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ function Demo() {
</div>
</>
);
}
};

render(<Demo />);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function Demo() {
<button onClick={close}>Close</button>
</div>
);
}
};

```

Expand Down
3 changes: 1 addition & 2 deletions packages/website-docusaurus/docs/browser/useEyeDropper.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ Use [EyeDropper API](https://developer.mozilla.org/en-US/docs/Web/API/EyeDropper
## Usage

```tsx live

function Demo() {
const [color, setColor] = useState("");
const [supported, open] = useEyeDropper();
Expand All @@ -28,7 +27,7 @@ function Demo() {
}

return <span>Not Supported by Your Browser</span>;
}
};

```

Expand Down
3 changes: 1 addition & 2 deletions packages/website-docusaurus/docs/browser/useFavicon.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ React side-effect hook sets the favicon of the page
## Usage

```tsx live

function Demo() {
const logo = 'https://react.dev/favicon.ico';
const twitter = 'https://twitter.com/favicon.ico';
Expand All @@ -30,7 +29,7 @@ function Demo() {
</button>
</div>
);
}
};

```

Expand Down
10 changes: 5 additions & 5 deletions packages/website-docusaurus/docs/browser/useFetchEventSource.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ function Demo() {
<div>Data: {JSON.stringify(data)}</div>
</div>
);
}
};

```

Expand Down Expand Up @@ -383,7 +383,7 @@ function Demo() {
<button onClick={close}>Close</button>
</div>
);
}
};

```

Expand Down Expand Up @@ -413,7 +413,7 @@ function Demo() {
<div>Latest message: {JSON.stringify(data)}</div>
</div>
);
}
};

```

Expand All @@ -437,7 +437,7 @@ function Demo() {
<div>Data: {JSON.stringify(data)}</div>
</div>
);
}
};

```

Expand Down Expand Up @@ -479,7 +479,7 @@ function Demo() {
<div>Latest Message: {data?.message}</div>
</div>
);
}
};

```

Expand Down
3 changes: 1 addition & 2 deletions packages/website-docusaurus/docs/browser/useFileDialog.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ Open file dialog with ease
## Usage

```tsx live

function Demo() {
const [files, open, reset] = useFileDialog();

Expand Down Expand Up @@ -34,7 +33,7 @@ function Demo() {
)}
</div>
);
}
};

```

Expand Down
3 changes: 1 addition & 2 deletions packages/website-docusaurus/docs/browser/useFps.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@ React Sensor Hooks that tracks FPS (frames per second)
## Usage

```tsx live

function Demo() {
const fps = useFps();

return <div>FPS: {fps}</div>;
}
};

```

Expand Down
3 changes: 1 addition & 2 deletions packages/website-docusaurus/docs/browser/useFullscreen.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ Display an element full-screen
## Usage

```tsx live

function Demo() {
const ref = useRef(null);
const [isFullscreen, { enterFullscreen, exitFullscreen, toggleFullscreen }]
Expand All @@ -33,7 +32,7 @@ function Demo() {
</div>
</div>
);
}
};

```

Expand Down
3 changes: 1 addition & 2 deletions packages/website-docusaurus/docs/browser/useGeolocation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ It allows the user to provide their location to web applications if they so desi
## Usage

```tsx live

function Demo() {
const { coordinates, locatedAt, error } = useGeolocation();

Expand All @@ -35,7 +34,7 @@ function Demo() {
</pre>
</div>
);
}
};

```

Expand Down
3 changes: 1 addition & 2 deletions packages/website-docusaurus/docs/browser/useIdle.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ React sensor hook that tracks if user on the page is idle
## Usage

```tsx live

function Demo() {
const isIdle = useIdle(3e3);

Expand All @@ -15,7 +14,7 @@ function Demo() {
<div>User is idle: {isIdle ? "Yes 😴" : "Nope"}</div>
</div>
);
}
};

```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ Infinite scrolling of the element
## Usage

```tsx live

function Demo() {
const ref = useRef<HTMLDivElement>(null);
const [data, setData] = useState([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
Expand Down Expand Up @@ -36,7 +35,7 @@ function Demo() {
</div>
</div>
);
}
};

```

Expand Down
3 changes: 1 addition & 2 deletions packages/website-docusaurus/docs/browser/useKeyModifier.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ React Sensor Hook that tracks state of any of the [supported modifiers](https://
## Usage

```tsx live

function Demo() {
const Button = (props: { mode: boolean; name: string }) => {
const { mode, name } = props;
Expand Down Expand Up @@ -38,7 +37,7 @@ function Demo() {
</div>
</div>
);
}
};

```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ For more information, [see](https://thisweekinreact.com/articles/useSyncExternal
## Usage

```tsx live noInline

function CurrentPathname() {
const pathname = useLocationSelector(location => location.pathname);
const ref = useRef(0);
Expand Down Expand Up @@ -36,7 +35,7 @@ function CurrentHash() {
<div>hashRender: {ref.current}</div>
</div>
);
}
};

function Links() {
return (
Expand All @@ -46,7 +45,7 @@ function Links() {
<a href="#link3">#link3</a>
</div>
);
}
};

function Demo() {
return (
Expand All @@ -56,9 +55,9 @@ function Demo() {
<Links />
</div>
);
}
};

render(<Demo/>)
render(<Demo/>);

```

Expand Down
3 changes: 1 addition & 2 deletions packages/website-docusaurus/docs/browser/useLongPress.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ React sensor hook that fires a callback after long pressing
## Usage

```tsx live

function Demo() {
const [state, setState] = useState("No Press");
const onLongPress = () => {
Expand All @@ -26,7 +25,7 @@ function Demo() {
<div>Pressed: {state}</div>
</div>
);
}
};

```

Expand Down
3 changes: 1 addition & 2 deletions packages/website-docusaurus/docs/browser/useMediaDevices.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@ React sensor hook that tracks connected hardware devices
## Usage

```tsx live

function Demo() {
const [state] = useMediaDevices({
requestPermissions: true,
});

return <pre>{JSON.stringify(state, null, 2)}</pre>;
}
};

```

Expand Down
3 changes: 1 addition & 2 deletions packages/website-docusaurus/docs/browser/useMediaQuery.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@ Ease with media query
## Usage

```tsx live

function Demo() {
const isWide = useMediaQuery("(min-width: 480px)");

return <div>Screen is wide: {isWide ? "Yes" : "No"}</div>;
}
};

```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@ React hook that returns `true` if the mobile device is in landscape mode and `fa
## Usage

```tsx live

function Demo() {
const isMobileLandscape = useMobileLandscape();
return <p>isMobileLandscape: {JSON.stringify(isMobileLandscape)}</p>;
}
};

```

Expand Down
3 changes: 1 addition & 2 deletions packages/website-docusaurus/docs/browser/useMouse.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ React sensor hooks that track cursor positio
## Usage

```tsx live

function Demo() {
const mouse = useMouse();

Expand All @@ -23,7 +22,7 @@ function Demo() {
</p>
</div>
);
}
};

```

Expand Down
Loading

0 comments on commit 8b0af60

Please sign in to comment.