Skip to content

Commit 38e5f9c

Browse files
committed
chore(format): apply prettier's new rules
1 parent 8030426 commit 38e5f9c

16 files changed

Lines changed: 673 additions & 606 deletions

CODE_OF_CONDUCT.md

Lines changed: 47 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,55 +2,85 @@
22

33
## 1. Purpose
44

5-
A primary goal of @smakss/react-scroll-direction is to be inclusive to the largest number of contributors, with the most varied and diverse backgrounds possible. As such, we are committed to providing a friendly, safe, and welcoming environment for all, regardless of gender, sexual orientation, ability, ethnicity, socioeconomic status, and religion (or lack thereof).
5+
A primary goal of @smakss/react-scroll-direction is to be inclusive to the
6+
largest number of contributors, with the most varied and diverse backgrounds
7+
possible. As such, we are committed to providing a friendly, safe, and welcoming
8+
environment for all, regardless of gender, sexual orientation, ability,
9+
ethnicity, socioeconomic status, and religion (or lack thereof).
610

7-
This Code of Conduct outlines our expectations for all those who participate in our community, as well as the consequences for unacceptable behavior.
11+
This Code of Conduct outlines our expectations for all those who participate in
12+
our community, as well as the consequences for unacceptable behavior.
813

914
## 2. Open [Source/Culture/Tech] Citizenship
1015

11-
A supplemental goal of this Code of Conduct is to increase open [source/culture/tech] citizenship by encouraging participants to recognize and strengthen the relationships between our actions and their effects on our community.
16+
A supplemental goal of this Code of Conduct is to increase open
17+
[source/culture/tech] citizenship by encouraging participants to recognize and
18+
strengthen the relationships between our actions and their effects on our
19+
community.
1220

1321
## 3. Expected Behavior
1422

1523
The following behaviors are expected and requested of all community members:
1624

17-
- Participate in an authentic and active way. In doing so, you contribute to the health and longevity of this community.
25+
- Participate in an authentic and active way. In doing so, you contribute to the
26+
health and longevity of this community.
1827
- Exercise consideration and respect in your speech and actions.
1928
- Attempt collaboration before conflict.
2029
- Refrain from demeaning, discriminatory, or harassing behavior and speech.
2130
- Be mindful of your surroundings and of your fellow participants.
22-
- Alert community leaders if you notice a dangerous situation, someone in distress, or violations of this Code of Conduct, even if they seem inconsequential.
31+
- Alert community leaders if you notice a dangerous situation, someone in
32+
distress, or violations of this Code of Conduct, even if they seem
33+
inconsequential.
2334

2435
## 4. Unacceptable Behavior
2536

26-
The following behaviors are considered harassment and are unacceptable within our community:
37+
The following behaviors are considered harassment and are unacceptable within
38+
our community:
2739

28-
- Violence, threats of violence, or violent language directed against another person.
29-
- Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
40+
- Violence, threats of violence, or violent language directed against another
41+
person.
42+
- Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory
43+
jokes and language.
3044
- Posting or displaying sexually explicit or violent material.
31-
- Posting or threatening to post other people's personally identifying information ("doxing").
32-
- Personal insults, particularly those related to gender, sexual orientation, race, religion, or disability.
45+
- Posting or threatening to post other people's personally identifying
46+
information ("doxing").
47+
- Personal insults, particularly those related to gender, sexual orientation,
48+
race, religion, or disability.
3349
- Inappropriate photography or recording.
34-
- Unwelcome sexual attention. This includes, but is not limited to: inappropriate touching, groping, and unwarranted comments.
50+
- Unwelcome sexual attention. This includes, but is not limited to:
51+
inappropriate touching, groping, and unwarranted comments.
3552
- Advocating for, or encouraging, any of the above behavior.
3653
- Stalking or following.
3754

3855
## 5. Consequences of Unacceptable Behavior
3956

40-
Unacceptable behavior from any community member, including sponsors and those with decision-making authority, will not be tolerated. Anyone asked to stop unacceptable behavior is expected to comply immediately.
57+
Unacceptable behavior from any community member, including sponsors and those
58+
with decision-making authority, will not be tolerated. Anyone asked to stop
59+
unacceptable behavior is expected to comply immediately.
4160

42-
If a community member engages in unacceptable behavior, the community organizers may take any action they deem appropriate, up to and including a temporary ban or permanent expulsion from the community without warning.
61+
If a community member engages in unacceptable behavior, the community organizers
62+
may take any action they deem appropriate, up to and including a temporary ban
63+
or permanent expulsion from the community without warning.
4364

4465
## 6. Reporting Guidelines
4566

46-
If you are subject to or witness unacceptable behavior, or have any other concerns, please notify a community organizer as soon as possible. @SMAKSS.
67+
If you are subject to or witness unacceptable behavior, or have any other
68+
concerns, please notify a community organizer as soon as possible. @SMAKSS.
4769

48-
Additionally, community organizers are available to help community members engage with local law enforcement or to otherwise help those experiencing unacceptable behavior feel safe.
70+
Additionally, community organizers are available to help community members
71+
engage with local law enforcement or to otherwise help those experiencing
72+
unacceptable behavior feel safe.
4973

5074
## 7. Addressing Grievances
5175

52-
If you feel you have been falsely or unfairly accused of violating this Code of Conduct, you should notify the project team with a concise description of your grievance. Your grievance will be handled in accordance with our existing governing policies.
76+
If you feel you have been falsely or unfairly accused of violating this Code of
77+
Conduct, you should notify the project team with a concise description of your
78+
grievance. Your grievance will be handled in accordance with our existing
79+
governing policies.
5380

5481
## 8. Scope
5582

56-
We expect all community participants (contributors, paid or otherwise; sponsors; and other guests) to abide by this Code of Conduct in all community venues–online and in-person–as well as in all one-on-one communications pertaining to community business.
83+
We expect all community participants (contributors, paid or otherwise; sponsors;
84+
and other guests) to abide by this Code of Conduct in all community
85+
venues–online and in-person–as well as in all one-on-one communications
86+
pertaining to community business.

CONTRIBUTING.md

Lines changed: 37 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,55 @@
11
# Contributing to @smakss/react-scroll-direction
22

3-
First and foremost, thank you for considering contributing to @smakss/react-scroll-direction! Your efforts help make this project better for everyone.
3+
First and foremost, thank you for considering contributing to
4+
@smakss/react-scroll-direction! Your efforts help make this project better for
5+
everyone.
46

57
## Getting Started
68

7-
- Please first discuss the change you wish to make via issue, email, or any other method with the maintainers of this repository before making a change.
8-
- Ensure that your contribution is in line with the project's coding and documentation standards.
9+
- Please first discuss the change you wish to make via issue, email, or any
10+
other method with the maintainers of this repository before making a change.
11+
- Ensure that your contribution is in line with the project's coding and
12+
documentation standards.
913

1014
## Development Setup
1115

12-
Before you start working on your contribution, you need to set up your development environment. After cloning the repository, run the following commands:
16+
Before you start working on your contribution, you need to set up your
17+
development environment. After cloning the repository, run the following
18+
commands:
1319

1420
```bash
1521
pnpm setup
1622
```
1723

18-
This will install all the necessary development dependencies and set up Git hooks using Husky.
24+
This will install all the necessary development dependencies and set up Git
25+
hooks using Husky.
1926

2027
## Pull Request Process
2128

22-
1. Ensure any install or build dependencies are removed before the end of the layer when doing a build.
23-
2. Update the `README.md` or relevant documentation with details of changes, including:
24-
- New environment variables
25-
- New database migrations
26-
- Any other relevant information
27-
3. Ensure your PR has a single purpose. If it addresses more than one issue or introduces more than one feature, split them into separate PRs.
28-
4. Describe your PR thoroughly. Explain the purpose of your PR, how you approached the problem, and include any relevant information or screenshots for context.
29+
1. Ensure any install or build dependencies are removed before the end of the
30+
layer when doing a build.
31+
2. Update the `README.md` or relevant documentation with details of changes,
32+
including:
33+
- New environment variables
34+
- New database migrations
35+
- Any other relevant information
36+
3. Ensure your PR has a single purpose. If it addresses more than one issue or
37+
introduces more than one feature, split them into separate PRs.
38+
4. Describe your PR thoroughly. Explain the purpose of your PR, how you
39+
approached the problem, and include any relevant information or screenshots
40+
for context.
2941

3042
## Release Process
3143

32-
Releases are automated with semantic-release on every push to the `master` branch.
44+
Releases are automated with semantic-release on every push to the `master`
45+
branch.
3346

34-
- Do not manually bump versions or edit the changelog; semantic-release handles both.
47+
- Do not manually bump versions or edit the changelog; semantic-release handles
48+
both.
3549
- Follow Conventional Commits so the release type can be inferred.
3650
- The GitHub Actions workflow requires these secrets:
37-
- `NPM_TOKEN` (publish to npm)
38-
- `GITHUB_TOKEN` (create GitHub release)
51+
- `NPM_TOKEN` (publish to npm)
52+
- `GITHUB_TOKEN` (create GitHub release)
3953

4054
To run a local dry run:
4155

@@ -45,16 +59,20 @@ pnpm release --dry-run
4559

4660
## Coding Standards
4761

48-
- Follow [Typescript specific conventions](https://google.github.io/styleguide/tsguide.html) and @smakss/react-scroll-direction's established coding style.
62+
- Follow
63+
[Typescript specific conventions](https://google.github.io/styleguide/tsguide.html)
64+
and @smakss/react-scroll-direction's established coding style.
4965
- Write tests for any new functionality.
5066
- Comment your code where necessary.
5167

5268
## Reporting Issues
5369

5470
- Use the provided issue templates if applicable.
55-
- Be as descriptive as possible. Attach screenshots, logs, or any other relevant information.
71+
- Be as descriptive as possible. Attach screenshots, logs, or any other relevant
72+
information.
5673
- Check existing issues before submitting a new one to avoid duplicates.
5774

5875
## Code of Conduct
5976

60-
Please refer to our [Code of Conduct](CODE_OF_CONDUCT.md) to understand what kind of behavior is expected within our community.
77+
Please refer to our [Code of Conduct](CODE_OF_CONDUCT.md) to understand what
78+
kind of behavior is expected within our community.

Readme.md

Lines changed: 42 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,25 @@
11
# React Scroll Direction Hook
22

3-
![npm](https://img.shields.io/npm/v/@smakss/react-scroll-direction) ![NPM](https://img.shields.io/npm/l/@smakss/react-scroll-direction) ![npm](https://img.shields.io/npm/dt/@smakss/react-scroll-direction) ![npm bundle size (scoped)](https://img.shields.io/bundlephobia/min/@smakss/react-scroll-direction)
4-
5-
`@smakss/react-scroll-direction` is a versatile, lightweight React hook that not only detects the scroll direction but also provides the scroll position in your application with ease. This enhanced functionality includes detecting distances from the top, bottom, left, and right edges of the viewport, making it an ideal solution for advanced scroll-based interactions in your React applications.
6-
7-
Originally inspired by a [popular StackOverflow response](https://stackoverflow.com/a/62497293/11908502), this package has evolved into a comprehensive tool for managing scroll detection in React applications.
3+
![npm](https://img.shields.io/npm/v/@smakss/react-scroll-direction)
4+
![NPM](https://img.shields.io/npm/l/@smakss/react-scroll-direction)
5+
![npm](https://img.shields.io/npm/dt/@smakss/react-scroll-direction)
6+
![npm bundle size (scoped)](https://img.shields.io/bundlephobia/min/@smakss/react-scroll-direction)
7+
8+
`@smakss/react-scroll-direction` is a versatile, lightweight React hook that not
9+
only detects the scroll direction but also provides the scroll position in your
10+
application with ease. This enhanced functionality includes detecting distances
11+
from the top, bottom, left, and right edges of the viewport, making it an ideal
12+
solution for advanced scroll-based interactions in your React applications.
13+
14+
Originally inspired by a
15+
[popular StackOverflow response](https://stackoverflow.com/a/62497293/11908502),
16+
this package has evolved into a comprehensive tool for managing scroll detection
17+
in React applications.
818

919
## Demo
1020

11-
Experience the extended capabilities of `@smakss/react-scroll-direction` on CodeSandbox:
21+
Experience the extended capabilities of `@smakss/react-scroll-direction` on
22+
CodeSandbox:
1223

1324
[![View @smakss/search](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/react-scroll-direction-tclwvp?fontsize=14&hidenavigation=1&theme=dark)
1425

@@ -29,40 +40,45 @@ Then, import it into your project:
2940
ES Module:
3041

3142
```js
32-
import useDetectScroll from '@smakss/react-scroll-direction';
43+
import useDetectScroll from '@smakss/react-scroll-direction'
3344
```
3445

3546
For TypeScript projects, import the hook and its types:
3647

3748
```ts
38-
import useDetectScroll, {
39-
Axis,
40-
Direction
41-
} from '@smakss/react-scroll-direction';
49+
import useDetectScroll, {Axis, Direction} from '@smakss/react-scroll-direction'
4250
```
4351

4452
## Usage
4553

46-
The `useDetectScroll` hook takes an options object with the following properties:
54+
The `useDetectScroll` hook takes an options object with the following
55+
properties:
4756

48-
- `target`: The target scrollable element from which to detect scroll direction and position (default: `window`, must be an `HTMLDivElement`).
49-
- `thr`: Threshold for scroll direction change detection (default: `0`, accepts only positive values).
57+
- `target`: The target scrollable element from which to detect scroll direction
58+
and position (default: `window`, must be an `HTMLDivElement`).
59+
- `thr`: Threshold for scroll direction change detection (default: `0`, accepts
60+
only positive values).
5061
- `axis`: Defines the scroll axis (`"y"` or `"x"`, default: `"y"`).
51-
- `scrollUp`: Value returned when scrolling up (y-axis) or left (x-axis) (default: `"up"` for y-axis, `"left"` for x-axis).
52-
- `scrollDown`: Value returned when scrolling down (y-axis) or right (x-axis) (default: `"down"` for y-axis, `"right"` for x-axis).
53-
- `still`: Value returned when there's no scrolling activity (default: `"still"`).
62+
- `scrollUp`: Value returned when scrolling up (y-axis) or left (x-axis)
63+
(default: `"up"` for y-axis, `"left"` for x-axis).
64+
- `scrollDown`: Value returned when scrolling down (y-axis) or right (x-axis)
65+
(default: `"down"` for y-axis, `"right"` for x-axis).
66+
- `still`: Value returned when there's no scrolling activity (default:
67+
`"still"`).
5468

5569
The hook returns an object with two properties:
5670

57-
- `scrollDir`: Indicates the scroll direction (`"up"`, `"down"`, `"left"`, `"right"`, or `"still"`).
58-
- `scrollPosition`: An object containing distances from the top, bottom, left, and right edges of the viewport.
71+
- `scrollDir`: Indicates the scroll direction (`"up"`, `"down"`, `"left"`,
72+
`"right"`, or `"still"`).
73+
- `scrollPosition`: An object containing distances from the top, bottom, left,
74+
and right edges of the viewport.
5975

6076
## Examples
6177

6278
To detect both scroll direction and position:
6379

6480
```js
65-
const { scrollDir, scrollPosition } = useDetectScroll();
81+
const {scrollDir, scrollPosition} = useDetectScroll()
6682

6783
// scrollDir: "up", "down", "left", "right", or "still"
6884
// scrollPosition: { top, bottom, left, right }
@@ -71,7 +87,7 @@ const { scrollDir, scrollPosition } = useDetectScroll();
7187
To customize for horizontal scroll:
7288

7389
```js
74-
const { scrollDir, scrollPosition } = useDetectScroll({ axis: Axis.X });
90+
const {scrollDir, scrollPosition} = useDetectScroll({axis: Axis.X})
7591

7692
// scrollDir: "left", "right", or "still"
7793
// scrollPosition: { top, bottom, left, right }
@@ -94,8 +110,11 @@ useEffect(() => {
94110

95111
## Contributing
96112

97-
Interested in making contributions to this project? Please see [CONTRIBUTING.md](./CONTRIBUTING.md) for guidelines and details.
113+
Interested in making contributions to this project? Please see
114+
[CONTRIBUTING.md](./CONTRIBUTING.md) for guidelines and details.
98115

99116
## Code of Conduct
100117

101-
We value and prioritize the well-being of all our contributors and users. To ensure that this project remains a welcoming space for everyone, please refer to our [Code of Conduct](./CODE_OF_CONDUCT.md).
118+
We value and prioritize the well-being of all our contributors and users. To
119+
ensure that this project remains a welcoming space for everyone, please refer to
120+
our [Code of Conduct](./CODE_OF_CONDUCT.md).

0 commit comments

Comments
 (0)