Skip to content

Commit

Permalink
refactor: ♻️ type callback on share (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
harshzalavadiya authored Oct 11, 2022
1 parent 241adb8 commit c2f9108
Show file tree
Hide file tree
Showing 4 changed files with 445 additions and 396 deletions.
26 changes: 13 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "react-web-share",
"author": "harshzalavadiya",
"version": "2.0.0",
"version": "2.0.1",
"description": "Tiny Web Share API Wrapper with fallback for unsupported browsers",
"license": "MIT",
"repository": "https://github.com/hc-oss/react-web-share",
Expand All @@ -25,27 +25,27 @@
},
"devDependencies": {
"@size-limit/preset-small-lib": "^8.1.0",
"@storybook/addon-actions": "^6.5.10",
"@storybook/addon-essentials": "^6.5.10",
"@storybook/addon-actions": "^6.5.12",
"@storybook/addon-essentials": "^6.5.12",
"@storybook/addon-knobs": "^6.4.0",
"@storybook/addon-links": "^6.5.10",
"@storybook/react": "^6.5.10",
"@types/react": "^18.0.18",
"@storybook/addon-links": "^6.5.12",
"@storybook/react": "^6.5.12",
"@types/react": "^18.0.21",
"@types/react-dom": "^18.0.6",
"@typescript-eslint/eslint-plugin": "^5.36.2",
"@typescript-eslint/parser": "^5.36.2",
"eslint": "8.23.0",
"@typescript-eslint/eslint-plugin": "^5.40.0",
"@typescript-eslint/parser": "^5.40.0",
"eslint": "8.25.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-react": "^7.31.7",
"eslint-plugin-storybook": "^0.6.4",
"postcss": "^8.4.16",
"eslint-plugin-react": "^7.31.10",
"eslint-plugin-storybook": "^0.6.6",
"postcss": "^8.4.17",
"prettier": "^2.7.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"size-limit": "^8.1.0",
"storybook-addon-turbo-build": "^1.1.0",
"tsup": "^6.2.3",
"typescript": "^4.8.2"
"typescript": "^4.8.4"
},
"browserslist": [
"defaults",
Expand Down
2 changes: 1 addition & 1 deletion src/components/icon/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default function Icon({ name, data, onClose, onClick }: IconProps) {
const { path, viewBox = "0 0 24 24", color, e } = IconList[name];

const handleOnButtonClicked = () => {
onClick && onClick(); // callback
onClick && onClick(name); // callback
e(encodeURIComponent(data.url), data.text, data.title);
onClose();
};
Expand Down
2 changes: 1 addition & 1 deletion stories/web-share-component.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const Default = () => (
url: "https://on.natgeo.com/2zHaNup",
title: "Flamingos",
}}
onClick={() => console.log("share successful!")}
onClick={(name) => console.log(`${name} share successful!`)}
>
<button>Share 🔗</button>
</RWebShare>
Expand Down
Loading

0 comments on commit c2f9108

Please sign in to comment.