Skip to content

Commit

Permalink
Merge pull request #13 from PranuPranav97/fix/docs
Browse files Browse the repository at this point in the history
Fix/docs
  • Loading branch information
PranuPranav97 authored Jun 26, 2023
2 parents fb15ce7 + 90df359 commit f36b9ee
Show file tree
Hide file tree
Showing 2 changed files with 96 additions and 0 deletions.
46 changes: 46 additions & 0 deletions docs/Hooks/useScreenBrightness.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
custom_edit_url: https://github.com/PranuPranav97/zop-hooks-docs
---

## useScreenBrightness

The `useScreenBrightness` hook is a custom React hook that allows you to get the current screen brightness of a device. It utilizes the `window.screen` API and the devicelight event to provide the brightness value.

### Usage

To use the `useScreenBrightness` hook, follow these steps:

Import the `useScreenBrightness` hook in your React component:

```typescript
import { useScreenBrightness } from "zop-hooks";
```

Call the `useScreenBrightness` hook within your functional component to retrieve the screen brightness value:

```typescript
const brightness = useScreenBrightness();
```

The `brightness` variable will hold the current screen brightness value.

### Example

Here's an example of how you can use the `useScreenBrightness` hook in a React component:

```typescript
import React from "react";
import { useScreenBrightness } from "./useScreenBrightness";

function MyComponent() {
const brightness = useScreenBrightness();

return (
<div>
<p>Screen Brightness: {brightness}</p>
</div>
);
}
```

In the example above, the `MyComponent` functional component uses the `useScreenBrightness` hook to retrieve the screen brightness value. The brightness value is then displayed in the component's output.
50 changes: 50 additions & 0 deletions docs/Hooks/useScreenOrientation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
---
custom_edit_url: https://github.com/PranuPranav97/zop-hooks-docs
---

## useScreenOrientation

The `useScreenOrientation` hook is a custom React hook that allows you to retrieve the current orientation of the screen. It utilizes the` window.screen.orientation` API and the `orientationchange` event to provide the orientation value.

### Usage

To use the `useScreenOrientation` hook, follow these steps:

Import the `useScreenOrientation` hook and the ScreenOrientation enum in your React component:

```typescript
import { useScreenOrientation, ScreenOrientation } from "zop-hooks";
```

Call the `useScreenOrientation` hook within your functional component to retrieve the screen orientation:

```typescript
const orientation = useScreenOrientation();
```

```typescript
const orientation = useScreenOrientation();
```

The orientation variable will hold the current screen orientation value, which will be one of the values from the ScreenOrientation enum.

### Example

Here's an example of how you can use the `useScreenOrientation` hook in a React component:

```typescript
import React from "react";
import { useScreenOrientation, ScreenOrientation } from "zop-hooks";

function MyComponent() {
const orientation = useScreenOrientation();

return (
<div>
<p>Screen Orientation: {orientation}</p>
</div>
);
}
```

In the example above, the `MyComponent` functional component uses the `useScreenOrientation` hook to retrieve the screen orientation. The orientation value is then displayed in the component's output.

0 comments on commit f36b9ee

Please sign in to comment.