Skip to content
Draft
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 .prettierrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"tabWidth": 2,
"printWidth": 120
}
}
4 changes: 2 additions & 2 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const config: StorybookConfig = {
docs: {},

typescript: {
reactDocgen: "react-docgen-typescript"
}
reactDocgen: "react-docgen-typescript",
},
};
export default config;
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,18 @@ We currently support just a few login buttons. Others will be implemented later.
<GitlabLoginButton onClick={() => alert("Hello")} />
```

### TwitchLoginButton

```jsx
<TwitchLoginButton onClick={() => alert("Hello")} />
```

### KickLoginButton

```jsx
<KickLoginButton onClick={() => alert("Hello")} />
```

## Create your own button

You can create your own button.
Expand Down Expand Up @@ -207,7 +219,6 @@ export default MyFacebookLoginButton;
Config can also look like.

```js

const config = {
text: "Log in with Facebook",
icon: MyIconComponent,
Expand Down
7 changes: 1 addition & 6 deletions src/buttons/DynamicIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,5 @@ type Props = {
export const DynamicIcon = ({ type: Component, size, format, color = "#FFFFFF" }: Props) => {
const renderIElement = typeof Component === "string";

return renderIElement ? (
<Icon {...{ format, name: Component, size }} />
) : (
<Component size={size} color={color} />
);
return renderIElement ? <Icon {...{ format, name: Component, size }} /> : <Component size={size} color={color} />;
};

20 changes: 20 additions & 0 deletions src/buttons/KickLoginButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import React from "react";
import { createButton } from "./create-button";

const config = {
activeStyle: { background: "#40d014" },
icon: Icon,
style: { background: "#53FC18", color: "#000000" },
text: "Log in with Kick",
};

export const KickLoginButton = createButton(config);

function Icon({ size, color }: { size: number | string; color: string }) {
return (
<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill={color} width={size} height={size}>
<title>Kick icon</title>
<path d="M4.79 2.4c-1.326 0-2.4 1.074-2.4 2.4V19.2c0 1.326 1.074 2.4 2.4 2.4h14.42c1.326 0 2.4-1.074 2.4-2.4V4.8c0-1.326-1.074-2.4-2.4-2.4H4.79zm5.664 4.32h1.728v4.752L17.1 6.72h2.22l-4.128 4.032L19.32 17.28h-2.28l-3.348-4.728-1.71 1.656v3.072H10.454V6.72z" />
</svg>
);
}
20 changes: 20 additions & 0 deletions src/buttons/TwitchLoginButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import React from "react";
import { createButton } from "./create-button";

const config = {
activeStyle: { background: "#772ce8" },
icon: Icon,
style: { background: "#9146FF", color: "#FFFFFF" },
text: "Log in with Twitch",
};

export const TwitchLoginButton = createButton(config);

function Icon({ size, color }: { size: number | string; color: string }) {
return (
<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill={color} width={size} height={size}>
<title>Twitch icon</title>
<path d="M11.571 4.714h1.715v5.143H11.57zm4.715 0H18v5.143h-1.714zM6 0L1.714 4.286v15.428h5.143V24l4.286-4.286h3.428L22.286 12V0zm14.571 11.143l-3.428 3.428h-3.429l-3 3v-3H6.857V1.714h13.714Z" />
</svg>
);
}
1 change: 0 additions & 1 deletion src/buttons/icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,4 @@ export const Icon = ({ name, size, format }: Props) => {
return <i className={format(name)} style={{ fontSize: size }} />;
};


export default Icon;
2 changes: 2 additions & 0 deletions src/buttons/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ export { TikTokLoginButton } from "./TikTokLoginButton";
export { MetamaskLoginButton } from "./MetamaskLoginButton";
export { GitlabLoginButton } from "./GitlabLoginButton";
export { XLoginButton } from "./XLoginButton";
export { TwitchLoginButton } from "./TwitchLoginButton";
export { KickLoginButton } from "./KickLoginButton";
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"skipLibCheck": true,
"sourceRoot": "" /* Specify the location where debugger should locate TypeScript files instead of source locations. */,
"mapRoot": "" /* Specify the location where debugger should locate map files instead of generated locations. */,
"forceConsistentCasingInFileNames": true, /* Disallow inconsistently-cased references to the same file. */
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */,
"jsx": "react"
}
}