Skip to content

Commit

Permalink
Merge pull request #288 from beautifulinteractions/feature/v1
Browse files Browse the repository at this point in the history
Typescript rewrite (version 1.0.0)
  • Loading branch information
antonioru authored and Antonio Russo committed Aug 27, 2021
2 parents 271dc64 + 6f31a70 commit 4eb3e37
Show file tree
Hide file tree
Showing 145 changed files with 2,077 additions and 2,303 deletions.
6 changes: 0 additions & 6 deletions .babelrc

This file was deleted.

1 change: 0 additions & 1 deletion .eslintignore
Expand Up @@ -2,4 +2,3 @@
/docs
/test
/docs
index.d.ts
22 changes: 17 additions & 5 deletions .eslintrc
@@ -1,16 +1,28 @@
{
"extends": "airbnb",
"parser": "babel-eslint",
"plugins": ["chai-expect", "react-hooks"],
"extends": [
"airbnb-base",
"airbnb-typescript"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 6,
"project": "./tsconfig.esm.json"
},
"plugins": [
"chai-expect",
"react-hooks"
],
"env": {
"browser": true,
"mocha": true
},
"rules": {
"max-len": ["error", { "code": 120 }],
"max-len": ["error", {"code": 140}],
"semi": [2, "never"],
"@typescript-eslint/semi": "off",
"linebreak-style": "off",
"object-curly-newline": "off",
"react/jsx-filename-extension": [1, { "extensions": [ ".js", ".jsx" ] } ]
"react/jsx-filename-extension": "off"
},
"overrides": [
{
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Expand Up @@ -17,7 +17,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12
node-version: 14
registry-url: https://registry.npmjs.org/

- name: NPM CI
Expand Down Expand Up @@ -45,7 +45,7 @@ jobs:
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Prepare distribution
run: cp package.json index.d.ts README.md LICENSE CHANGELOG.md CONTRIBUTING.md CODE_OF_CONDUCT.md ./dist
run: cp package.json README.md LICENSE CHANGELOG.md CONTRIBUTING.md CODE_OF_CONDUCT.md ./dist

- name: Publish
run: |
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Expand Up @@ -725,3 +725,9 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
### Added

- `useSwipeEvents` exports`onSwipeEnd`,`onSwipeStart`

## [1.0.0] - 2021-08-27

### Change

- Complete typescript rewrite
17 changes: 0 additions & 17 deletions README.md
Expand Up @@ -48,8 +48,6 @@ to keep the learning curve as lower as possible so that the it can be used and s
* Concise API
* Small and lightweight
* Easy to learn
* Functional approach
* Fully written in JS (although TS types are supported)

<div>
<p align="center">
Expand Down Expand Up @@ -134,21 +132,6 @@ To submit your custom hook, please make sure your read our [CONTRIBUTING](./CONT
* [@testing-library/react](https://testing-library.com/docs/react-testing-library/intro)
* [@testing-library/react-hooks](https://react-hooks-testing-library.com/)


### Credits

This library is provided and sponsored by:

<div>
<p>
<a href="https://beautifulinteractions.com/">
<img src="https://beautifulinteractions.com/img/logo-colorful.svg" alt="Beautiful interactions" width="140px" />
</a>
</p>
</div>

As part of our commitment to support and contribute to the open source community.

---

Icon made by [Freepik](https://www.flaticon.com/authors/freepik) from [www.flaticon.com](https://www.flaticon.com/free-icon/hook_1081812)
3 changes: 3 additions & 0 deletions babel.config.js
@@ -0,0 +1,3 @@
module.exports = {
presets: ['@babel/react', '@babel/env']
}
10 changes: 6 additions & 4 deletions docs/Installation.md
@@ -1,18 +1,20 @@
# Getting started


Using `npm`:

```bash
$ npm i --save beautiful-react-hooks
```

Using `yarn`:

```bash
$ yarn add beautiful-react-hooks
```

then just import any hook described by the documentation in your React component file:

```js
import { useSomeHook } from 'beautiful-react-hooks';
```
```ts static
import { useSomeHook } from 'beautiful-react-hooks'
import useSomeHook from 'beautiful-react-hoks/useSomeHook'
```
17 changes: 1 addition & 16 deletions docs/Introduction.md
Expand Up @@ -10,33 +10,18 @@ components and hooks development.

## 💡 Why?

React custom hooks allow to abstract components' business logic into single reusable functions.<br />
React custom hooks allow abstracting components' business logic into single reusable functions.<br />
So far, I've found that most of the hooks I've created and therefore shared between my projects have quite often a
similar gist that involves callback references, events and components' lifecycle. <br />
For this reason I've tried to sum up that gist into `beautiful-react-hooks`: a collection of (*hopefully*) useful
React hooks to possibly help other developers to speed up their development process.<br /><br />
Furthermore, I've tried to create a concise yet concrete API having in mind the code readability, focusing
to keep the learning curve as lower as possible so that the it can be used and shared in bigger teams.


## ☕️ Features

* Concise API
* Small and lightweight
* Easy to learn
* Functional approach
* Fully written in JS (although TS types are supported)

### Credits

This library is provided and sponsored by:

<div>
<p>
<a href="https://beautifulinteractions.com/">
<img src="https://beautifulinteractions.com/img/logo-colorful.svg" alt="Beautiful interactions" width="140px" />
</a>
</p>
</div>

As part of our commitment to support and provide the open source community.
45 changes: 0 additions & 45 deletions docs/styleguidist/CustomComponentListRenderer.js

This file was deleted.

28 changes: 0 additions & 28 deletions docs/styleguidist/CustomLogo.js

This file was deleted.

11 changes: 0 additions & 11 deletions docs/styleguidist/CustomSidebar.js

This file was deleted.

13 changes: 0 additions & 13 deletions docs/styleguidist/getHooksDocFiles.js

This file was deleted.

35 changes: 0 additions & 35 deletions docs/styleguidist/styleguidist.config.js

This file was deleted.

27 changes: 0 additions & 27 deletions docs/styleguidist/webpack.config.js

This file was deleted.

2 changes: 1 addition & 1 deletion docs/useValidatedState.md
Expand Up @@ -40,4 +40,4 @@ const ValidatedField = () => {

#### ✅ good to know:

- useValidatedState does not re-render your component twice to save the validation state.
- useValidatedState does not re-render your component twice to save the validation state.
26 changes: 26 additions & 0 deletions docs/utils/_CustomLogo.js
@@ -0,0 +1,26 @@
import React from 'react'
import PropTypes from 'prop-types'
import Styled from 'rsg-components/Styled'
import logo from './_doc-logo.png'

const styles = ({ fontFamily, color }) => ({
logo: {
display: 'block'
},
image: {
width: '100%'
}
})

const LogoRenderer = ({ classes }) => (
<h1 className={classes.logo}>
<img className={classes.image} src={logo} alt="Beautiful React Hooks" />
</h1>
)

LogoRenderer.propTypes = {
classes: PropTypes.object.isRequired,
children: PropTypes.node
}

export default Styled(styles)(LogoRenderer)
File renamed without changes.
2 changes: 1 addition & 1 deletion docs/styleguidist/custom.css → docs/utils/_custom.css
Expand Up @@ -2,5 +2,5 @@
@import "~beautiful-react-ui/beautiful-react-ui.css";

body {
font-family: 'Ubuntu', sans-serif;
font-family: 'Ubuntu', sans-serif;
}
File renamed without changes
File renamed without changes.
Expand Up @@ -36,9 +36,6 @@ module.exports = {
},
},
StyleGuide: {
logo: {
display: 'none',
},
sidebar: {
border: 0,
width: '16rem',
Expand Down

0 comments on commit 4eb3e37

Please sign in to comment.