Skip to content

Commit 74a1d3b

Browse files
Add Twitch and Kick social login buttons
Co-authored-by: michaeljscript <19684576+michaeljscript@users.noreply.github.com>
1 parent eb9d00b commit 74a1d3b

File tree

9 files changed

+59
-12
lines changed

9 files changed

+59
-12
lines changed

.prettierrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"tabWidth": 2,
33
"printWidth": 120
4-
}
4+
}

.storybook/main.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const config: StorybookConfig = {
1818
docs: {},
1919

2020
typescript: {
21-
reactDocgen: "react-docgen-typescript"
22-
}
21+
reactDocgen: "react-docgen-typescript",
22+
},
2323
};
2424
export default config;

README.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,18 @@ We currently support just a few login buttons. Others will be implemented later.
177177
<GitlabLoginButton onClick={() => alert("Hello")} />
178178
```
179179

180+
### TwitchLoginButton
181+
182+
```jsx
183+
<TwitchLoginButton onClick={() => alert("Hello")} />
184+
```
185+
186+
### KickLoginButton
187+
188+
```jsx
189+
<KickLoginButton onClick={() => alert("Hello")} />
190+
```
191+
180192
## Create your own button
181193

182194
You can create your own button.
@@ -207,7 +219,6 @@ export default MyFacebookLoginButton;
207219
Config can also look like.
208220

209221
```js
210-
211222
const config = {
212223
text: "Log in with Facebook",
213224
icon: MyIconComponent,

src/buttons/DynamicIcon.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,5 @@ type Props = {
1111
export const DynamicIcon = ({ type: Component, size, format, color = "#FFFFFF" }: Props) => {
1212
const renderIElement = typeof Component === "string";
1313

14-
return renderIElement ? (
15-
<Icon {...{ format, name: Component, size }} />
16-
) : (
17-
<Component size={size} color={color} />
18-
);
14+
return renderIElement ? <Icon {...{ format, name: Component, size }} /> : <Component size={size} color={color} />;
1915
};
20-

src/buttons/KickLoginButton.tsx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import React from "react";
2+
import { createButton } from "./create-button";
3+
4+
const config = {
5+
activeStyle: { background: "#40d014" },
6+
icon: Icon,
7+
style: { background: "#53FC18", color: "#000000" },
8+
text: "Log in with Kick",
9+
};
10+
11+
export const KickLoginButton = createButton(config);
12+
13+
function Icon({ size, color }: { size: number | string; color: string }) {
14+
return (
15+
<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill={color} width={size} height={size}>
16+
<title>Kick icon</title>
17+
<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" />
18+
</svg>
19+
);
20+
}

src/buttons/TwitchLoginButton.tsx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import React from "react";
2+
import { createButton } from "./create-button";
3+
4+
const config = {
5+
activeStyle: { background: "#772ce8" },
6+
icon: Icon,
7+
style: { background: "#9146FF", color: "#FFFFFF" },
8+
text: "Log in with Twitch",
9+
};
10+
11+
export const TwitchLoginButton = createButton(config);
12+
13+
function Icon({ size, color }: { size: number | string; color: string }) {
14+
return (
15+
<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill={color} width={size} height={size}>
16+
<title>Twitch icon</title>
17+
<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" />
18+
</svg>
19+
);
20+
}

src/buttons/icon.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,4 @@ export const Icon = ({ name, size, format }: Props) => {
1010
return <i className={format(name)} style={{ fontSize: size }} />;
1111
};
1212

13-
1413
export default Icon;

src/buttons/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,5 @@ export { TikTokLoginButton } from "./TikTokLoginButton";
1919
export { MetamaskLoginButton } from "./MetamaskLoginButton";
2020
export { GitlabLoginButton } from "./GitlabLoginButton";
2121
export { XLoginButton } from "./XLoginButton";
22+
export { TwitchLoginButton } from "./TwitchLoginButton";
23+
export { KickLoginButton } from "./KickLoginButton";

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"skipLibCheck": true,
2121
"sourceRoot": "" /* Specify the location where debugger should locate TypeScript files instead of source locations. */,
2222
"mapRoot": "" /* Specify the location where debugger should locate map files instead of generated locations. */,
23-
"forceConsistentCasingInFileNames": true, /* Disallow inconsistently-cased references to the same file. */
23+
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */,
2424
"jsx": "react"
2525
}
2626
}

0 commit comments

Comments
 (0)