Skip to content

Commit 78db74b

Browse files
Add TikTok Login Button
1 parent cc29169 commit 78db74b

File tree

6 files changed

+43
-2
lines changed

6 files changed

+43
-2
lines changed

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ A simple package to display social login buttons using React.
77
Buttons do not provide any social logic.
88
They are only visual components listening to some events triggered by the user.
99

10-
![Social login buttons](https://raw.githubusercontent.com/MichalSzorad/react-social-login-buttons/develop/examples/simple/screenshot2.png)
10+
![Social login buttons](https://raw.githubusercontent.com/MichalSzorad/react-social-login-buttons/develop/examples/simple/screenshot3.png)
1111

1212
## Install
1313

@@ -153,6 +153,12 @@ We currently support just a few login buttons. Others will be implemented later.
153153
<ZaloLoginButton onClick={() => alert('Hello')} />
154154
```
155155

156+
### TikTokLoginButton
157+
158+
```jsx
159+
<TikTokLoginButton onClick={() => alert('Hello')} />
160+
```
161+
156162
## Create your own button
157163

158164
You can create your own button.

examples/simple/screenshot3.png

243 KB
Loading

src/buttons/TikTokLoginButton.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import React from 'react';
2+
import T from 'prop-types';
3+
import createButton from './create-button';
4+
import createSvgIcon from './createSvgIcon';
5+
6+
const config = {
7+
activeStyle: { background: '#333333' },
8+
icon: createSvgIcon(Icon),
9+
style: { background: '#000000', color: '#FFFFFF' },
10+
text: 'Log in with TikTok',
11+
};
12+
13+
const TikTokLoginButton = createButton(config);
14+
15+
export default TikTokLoginButton;
16+
17+
function Icon ({ width, height, color }) {
18+
return (<svg
19+
xmlns="http://www.w3.org/2000/svg"
20+
width={width}
21+
height={height}
22+
fill={color}
23+
viewBox="0 0 512 512"
24+
>
25+
<path d="M412.19 118.66a109.27 109.27 0 01-9.45-5.5 132.87 132.87 0 01-24.27-20.62c-18.1-20.71-24.86-41.72-27.35-56.43h.1C349.14 23.9 350 16 350.13 16h-82.44v318.78c0 4.28 0 8.51-.18 12.69 0 .52-.05 1-.08 1.56 0 .23 0 .47-.05.71v.18a70 70 0 01-35.22 55.56 68.8 68.8 0 01-34.11 9c-38.41 0-69.54-31.32-69.54-70s31.13-70 69.54-70a68.9 68.9 0 0121.41 3.39l.1-83.94a153.14 153.14 0 00-118 34.52 161.79 161.79 0 00-35.3 43.53c-3.48 6-16.61 30.11-18.2 69.24-1 22.21 5.67 45.22 8.85 54.73v.2c2 5.6 9.75 24.71 22.38 40.82A167.53 167.53 0 00115 470.66v-.2l.2.2c39.91 27.12 84.16 25.34 84.16 25.34 7.66-.31 33.32 0 62.46-13.81 32.32-15.31 50.72-38.12 50.72-38.12a158.46 158.46 0 0027.64-45.93c7.46-19.61 9.95-43.13 9.95-52.53V176.49c1 .6 14.32 9.41 14.32 9.41s19.19 12.3 49.13 20.31c21.48 5.7 50.42 6.9 50.42 6.9v-81.84c-10.14 1.1-30.73-2.1-51.81-12.61z" />
26+
</svg>);
27+
}
28+
29+
Icon.propTypes = {
30+
width: T.oneOfType([T.number, T.string]),
31+
height: T.oneOfType([T.number, T.string]),
32+
};

src/buttons/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@ export { default as YahooLoginButton } from './YahooLoginButton';
1616
export { default as createButton } from './create-button';
1717
export { default as createSvgIcon } from './createSvgIcon';
1818
export { default as ZaloLoginButton } from './ZaloLoginButton';
19+
export { default as TikTokLoginButton } from './TikTokLoginButton';

src/types.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ declare class SlackLoginButton extends SpecificSocialLoginButton { }
6161
declare class OktaLoginButton extends SpecificSocialLoginButton { }
6262
declare class YahooLoginButton extends SpecificSocialLoginButton { }
6363
declare class ZaloLoginButton extends SpecificSocialLoginButton { }
64+
declare class TikTokLoginButton extends SpecificSocialLoginButton { }
6465

6566

6667
declare const createButton: (props: SpecificSocialLoginButtonProps) => React.ComponentClass<SpecificSocialLoginButtonProps>;
@@ -83,6 +84,7 @@ export {
8384
OktaLoginButton,
8485
YahooLoginButton,
8586
ZaloLoginButton,
87+
TikTokLoginButton,
8688
createButton,
8789
createSvgIcon,
8890
}

stories/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ storiesOf("Social login buttons", module)
5454

5555

5656
function AllButtons () {
57-
const components = Object.values(buttons);
57+
const components = Object.values(buttons).filter(e => e !== buttons.createButton && e !== buttons.createSvgIcon);
5858
return (<div style={{ display: 'flex', flexWrap: 'wrap' }}>{components.map((Button, i) => (<div key={i} style={{ width: '30%' }}>
5959
<Button onClick={() => alert('hello')} />
6060
</div>))}</div>);

0 commit comments

Comments
 (0)