Skip to content

Commit 4c4c111

Browse files
committed
feat: add functions
1 parent 9658b41 commit 4c4c111

20 files changed

+205
-147
lines changed

.releaserc.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"plugins": [
1111
"@semantic-release/commit-analyzer",
1212
"@semantic-release/release-notes-generator",
13+
"@semantic-release/changelog",
1314
"@semantic-release/npm",
1415
"@semantic-release/github",
1516
"@semantic-release/git"

README.md

Lines changed: 7 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,13 @@
1-
# typescript-react-lib-swc
1+
# react-essentials-functions
22

3-
A simple react boilerplate for creating a library of components made in typescript using `swc`.
3+
A collection of useful `hooks` and `components` for React that I use in my projects.
44

5-
It also uses:
6-
- `storybook` for viewing a components
7-
- `testing-library` for testing components
8-
- `semantic-release` for publishing a package for this library components
5+
## Installation
96

10-
## Clone repository and install dependencies
11-
12-
```sh
13-
git clone https://github.com/maxgfr/typescript-react-lib-swc # For cloning the repository
14-
cd typescript-react-lib-swc # To navigate to the repository root
15-
yarn # Install dependencies
16-
```
17-
18-
## Building the code
19-
20-
```sh
21-
yarn build # For building the code with typechecking
22-
yarn build:swc # For building without typechecking
7+
```bash
8+
yarn add react-essentials-functions
239
```
2410

25-
> **:warning: No typechecking made in dev mode**
26-
27-
## Testing the code
11+
## Usage
2812

29-
```sh
30-
yarn test # For running unit test
31-
yarn test:watch # For watching unit test
32-
```
13+
Documentation is in progress...

package.json

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,26 @@
11
{
2-
"name": "typescript-react-lib-swc",
3-
"version": "1.0.1",
2+
"name": "react-essentials-functions",
3+
"version": "1.0.0",
44
"author": "maxgfr",
55
"license": "MIT",
6-
"description": "A minimalist typescript swc starter for react",
6+
"description": "A collection of zero-dependencies useful hooks and components for React",
77
"main": "./build/index.js",
88
"repository": {
99
"type": "git",
10-
"url": "https://github.com/maxgfr/typescript-react-lib-swc.git"
10+
"url": "https://github.com/maxgfr/react-essentials-functions.git"
1111
},
1212
"bugs": {
13-
"url": "https://github.com/maxgfr/typescript-react-lib-swc/issues"
13+
"url": "https://github.com/maxgfr/react-essentials-functions/issues"
1414
},
15-
"homepage": "https://github.com/maxgfr/typescript-react-lib-swc#readme",
15+
"homepage": "https://github.com/maxgfr/react-essentials-functions#readme",
1616
"files": [
1717
"build"
1818
],
1919
"keywords": [
20-
"boilerplate",
21-
"typescript",
22-
"swc",
20+
"hooks",
2321
"react",
24-
"storybook",
25-
"@testing-library"
22+
"components",
23+
"useful"
2624
],
2725
"scripts": {
2826
"dev": "nodemon",
@@ -42,12 +40,13 @@
4240
"storybook:deploy:action": "npm run storybook:build && gh-pages -d storybook-static -u \"github-actions-bot <support+actions@github.com>\"",
4341
"release": "semantic-release"
4442
},
45-
"dependencies": {
46-
"react": "^18.2.0",
47-
"react-dom": "^18.2.0"
43+
"peerDependencies": {
44+
"react": "*",
45+
"react-dom": "*"
4846
},
4947
"devDependencies": {
5048
"@babel/core": "^7.20.2",
49+
"@semantic-release/changelog": "^6.0.2",
5150
"@semantic-release/commit-analyzer": "^9.0.2",
5251
"@semantic-release/git": "^10.0.1",
5352
"@semantic-release/github": "^8.0.6",

src/HelloWorld.tsx

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

src/Input.tsx

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

src/__tests__/HelloWorld.test.tsx

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

src/__tests__/Input.test.tsx

Lines changed: 0 additions & 17 deletions
This file was deleted.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import * as React from 'react';
2+
3+
export type ConditionnalWrapperProps = {
4+
condition: boolean;
5+
wrapper: (children: React.ReactNode) => React.ReactNode;
6+
children: React.ReactNode;
7+
};
8+
9+
export const ConditionalWrapper = ({
10+
condition,
11+
wrapper,
12+
children,
13+
}: ConditionnalWrapperProps) => (condition ? wrapper(children) : children);
14+
15+
// <ConditionalWrapper
16+
// condition={link}
17+
// wrapper={children => <a href={link}>{children}</a>}
18+
// >
19+
// .....
20+
// </ConditionalWrapper>

src/components/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './ConditionnalWrapper';

src/hooks/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export * from './useDimensions';
2+
export * from './useSafeFetch';
3+
export * from './useSafeState';
4+
export * from './useScript';
5+
export * from './useTheme';
6+
export * from './useWindowDimensions';

0 commit comments

Comments
 (0)