Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/handle-types #11

Merged
merged 2 commits into from
Sep 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
@NAMESPACE:registry=https://github.com/GhassenEljday/react-mobile-app-button
@NAMESPACE:registry=https://github.com/GhassenEljday/react-mobile-app-button
34 changes: 22 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

A react component that allows you to place an iOS App Store, Google Play Store and Huawei AppGallery Download button!

Check documentation here => **[React Mobile App Button Docs](https://react-mobile-app-button-one.vercel.app/?path=/docs/example-google-play-button--docs)**
Check documentation here => **[React Mobile App Button Docs](https://react-mobile-app-button-one.vercel.app/?path=/docs/example-google-play-button--docs)**

## Install

Expand All @@ -29,9 +29,10 @@ Example Code:

```js
import { GooglePlayButton } from "react-mobile-app-button";

export const MyComponent = () => {
const APKUrl =
"https://play.google.com/store/apps/details?id=host.exp.exponent";
const APKUrl = "https://play.google.com/store/apps/details?id=host";

return (
<div>
<GooglePlayButton
Expand All @@ -52,17 +53,19 @@ import {
AppGalleryButton,
ButtonsContainer,
} from "react-mobile-app-button";

export const MyComponent = () => {
const APKUrl =
"https://play.google.com/store/apps/details?id=host.exp.exponent";
const APKUrl = "https://play.google.com/store/apps/details?id=host";
const iOSUrl = "https://apps.apple.com/us/app/expo-go/id982107779";

return (
<ButtonsContainer>
<GooglePlayButton
url={APKUrl}
theme={"light"}
className={"custom-style"}
/>

<AppGalleryButton
url={iOSUrl}
theme={"light"}
Expand All @@ -79,27 +82,34 @@ export const MyComponent = () => {
| --------- | -------------------------------------------------------- | ---------------- | --------------------------------- |
| url | `GooglePlayButton`, `AppGalleryButton`, `AppStoreButton` | string | Store URL |
| theme | `GooglePlayButton`, `AppGalleryButton`, `AppStoreButton` | "dark" / "light" | Button Theme |
| className | `GooglePlayButton`, `AppGalleryButton`, `AppStoreButton` | string | For manual styling |
| className | `GooglePlayButton`, `AppGalleryButton`, `AppStoreButton` | string | For manual styling |
| title | `GooglePlayButton`, `AppGalleryButton`, `AppStoreButton` | string | For custom message |
| height | `GooglePlayButton`, `AppGalleryButton`, `AppStoreButton` | number | For manually styling |
| width | `GooglePlayButton`, `AppGalleryButton`, `AppStoreButton` | number | For manually styling |
| gap | `ButtonsContainer` | number | Control the space between buttons |
| direction | `ButtonsContainer` | "row" / "column" | Control flex direction |
| |
| |

## Install and run the project


Clone the repository

```bash
gir clone https://github.com/GhassenEljday/react-mobile-app-button.git
git clone https://github.com/GhassenEljday/react-mobile-app-button.git
```

Install the dependencies

```bash
npm install
npm install
```

Finally you can run the project using `StoryBook`
Finally you can run the project using `StoryBook`

```bash
npm run storybook
```
```

##

[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/J3J5CGNZQ)
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
{
"name": "react-mobile-app-button",
"version": "1.1.13",
"version": "1.2.14",
"description": "A react component which allows you to place an iOS App Store, Google Play Store and Huawei AppGallery Download button!",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "babel src --extensions .ts,.tsx --out-dir lib && cp -R src/assets lib/",
"build": "npm run build:types && npm run build:js",
"build:js": "babel src --extensions .ts,.tsx --out-dir lib && cp -R src/assets lib/",
"build:types": "tsc",
"storybook": "storybook dev -p 6006",
"build-storybook": "storybook build",
"serve-storybook": "npx serve storybook-static"
Expand All @@ -31,6 +33,7 @@
],
"author": "Ghassen Eljday",
"license": "MIT",
"homepage": "https://react-mobile-app-button-one.vercel.app/?path=/docs/example-google-play-button--docs",
"devDependencies": {
"@babel/cli": "^7.21.5",
"@babel/core": "^7.21.8",
Expand Down
6 changes: 3 additions & 3 deletions src/components/AppGalleryButton/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ type AppGalleryButtonProps = {
theme?: "dark" | "light";

/**
* @default "EXPLORE IT ON"
* @default EXPLORE IT ON
*/
title: string;
title?: string;

/**
* @default 60px
Expand All @@ -39,8 +39,8 @@ type AppGalleryButtonProps = {
*
* @param {string} theme Choose a theme between dark and light
* @param {number} height Controls the height of the button
* @param {string} title Custom title in button
* @param {number} width Controls the width of the button
* @param {string} title Set custom title for the button
* @param {string} className Add className to the button in order to customize the button appearance
* @param {string} url Add your store url to the button
* @example <AppGalleryButton theme="light" height={70} width={130} className="button-container" url="https://appgallery.huawei.com/" />
Expand Down
6 changes: 3 additions & 3 deletions src/components/AppStoreButton/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ type AppStoreButtonProps = {
theme?: "dark" | "light";

/**
* @default "Download on the"
* @default Download on the
*/
title: string;
title?: string;

/**
* @default 60px
Expand All @@ -40,8 +40,8 @@ type AppStoreButtonProps = {
*
* @param {string} theme Choose a theme between dark and light
* @param {number} height Controls the height of the button
* @param {number} height Controls the height of the button
* @param {number} width Controls the width of the button
* @param {string} title Set custom title for the button
* @param {string} className Add className to the button in order to customize the button appearance
* @param {string} url Add your store url to the button
* @example <AppStoreButton theme="light" height={70} width={130} className="button-container" url="https://www.apple.com/app-store/" />
Expand Down
5 changes: 3 additions & 2 deletions src/components/GooglePlayButton/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ type GooglePlayButtonProps = {
theme?: "dark" | "light";

/**
* @default "GET IT ON"
* @default GET IT ON
*/
title: string;
title?: string;

/**
* @default 60px
Expand Down Expand Up @@ -40,6 +40,7 @@ type GooglePlayButtonProps = {
* @param {string} theme Choose a theme between dark and light
* @param {number} height Controls the height of the button
* @param {number} width Controls the width of the button
* @param {string} title Set custom title for the button
* @param {string} className Add className to the button in order to customize the button appearance
* @param {string} url Add your store url to the button
* @example <GooglePlayButton theme="light" height={70} width={130} className="button-container" url="https://play.google.com/" />
Expand Down
4 changes: 2 additions & 2 deletions src/stories/AppGalleryButton.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ export const CustomWidth = {
};

/**
* Example: "EXPLORE IT ON"
* Example: "EXPLÓRALO EN"
*/
export const CustomTitle = {
args: {
title: "EXPLORE IT ON",
title: "EXPLÓRALO EN",
},
};
4 changes: 2 additions & 2 deletions src/stories/AppStoreButton.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ export const CustomWidth = {
};

/**
* Example: title "Download on the"
* Example: title "Descargar en"
*/
export const CustomTitle = {
args: {
title: "Download on the",
title: "Descargar en",
},
};
14 changes: 12 additions & 2 deletions src/stories/GooglePlayButton.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,20 @@ export const CustomHeight = {
};

/**
* Example: "GET IT ON"
* Example: width 160px
*/
export const CustomWidth = {
args: {
theme: "dark",
width: 160,
},
};

/**
* Example: "PÓNGALO EN MARCHA"
*/
export const CustomTitle = {
args: {
title: "GET IT ON",
title: "PÓNGALO EN MARCHA",
},
};
20 changes: 11 additions & 9 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
{
"compilerOptions": {
"jsx": "react",
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"declaration": true,
"emitDeclarationOnly": true,
"isolatedModules": true
}
}
"compilerOptions": {
"jsx": "react",
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"declaration": true,
"emitDeclarationOnly": true,
"isolatedModules": true,
"outDir": "./lib",
"rootDir": "./src"
}
}