-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
comp(social-login-buttons) Initial version
- Loading branch information
Showing
17 changed files
with
455 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2020 Hacklone <[email protected]> | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
[npm-url]: https://npmjs.org/package/@angular-cool/social-login-buttons | ||
[npm-image]: https://img.shields.io/npm/v/@angular-cool/social-login-buttons.svg | ||
[downloads-image]: https://img.shields.io/npm/dm/@angular-cool/social-login-buttons.svg | ||
[total-downloads-image]: https://img.shields.io/npm/dt/@angular-cool/social-login-buttons.svg | ||
|
||
# @angular-cool/social-login-buttons [![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Total Downloads][total-downloads-image]][npm-url] | ||
Cool social login buttons for angular | ||
|
||
## Install | ||
> npm install --save @angular-cool/social-login-buttons | ||
## Setup | ||
```javascript | ||
import { NgModule } from '@angular/core'; | ||
import { CoolLoadingButtonModule } from '@angular-cool/social-login-buttons'; | ||
|
||
@NgModule({ | ||
imports: [CoolSocialLoginButtonsModule] | ||
}) | ||
export class MyAppModule {} | ||
``` | ||
|
||
## Google button | ||
|
||
### Usage | ||
|
||
```html | ||
<cool-google-button style="dark" (click)="onGoogleLoginClicked()"> | ||
Login with Google | ||
</cool-google-button> | ||
``` | ||
|
||
### API | ||
#### Inputs | ||
* \[style] | ||
- Type: 'dark' | 'light' | ||
- Style of the button | ||
|
||
* \[disabled] | ||
- Type: boolean | ||
- Whether the button is disabled | ||
|
||
#### Outputs | ||
* \(click) | ||
- Type: MouseEvent | ||
- Called when the button has been clicked | ||
|
||
## License | ||
> The MIT License (MIT) | ||
> Copyright (c) 2020 Hacklone | ||
> https://github.com/Hacklone | ||
> Permission is hereby granted, free of charge, to any person obtaining a copy | ||
> of this software and associated documentation files (the "Software"), to deal | ||
> in the Software without restriction, including without limitation the rights | ||
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
> copies of the Software, and to permit persons to whom the Software is | ||
> furnished to do so, subject to the following conditions: | ||
> The above copyright notice and this permission notice shall be included in all | ||
> copies or substantial portions of the Software. | ||
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
> SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Karma configuration file, see link for more information | ||
// https://karma-runner.github.io/1.0/config/configuration-file.html | ||
|
||
module.exports = function (config) { | ||
config.set({ | ||
basePath: '', | ||
frameworks: ['jasmine', '@angular-devkit/build-angular'], | ||
plugins: [ | ||
require('karma-jasmine'), | ||
require('karma-chrome-launcher'), | ||
require('karma-jasmine-html-reporter'), | ||
require('karma-coverage-istanbul-reporter'), | ||
require('@angular-devkit/build-angular/plugins/karma') | ||
], | ||
client: { | ||
clearContext: false // leave Jasmine Spec Runner output visible in browser | ||
}, | ||
coverageIstanbulReporter: { | ||
dir: require('path').join(__dirname, '../../coverage/social-login-buttons'), | ||
reports: ['html', 'lcovonly', 'text-summary'], | ||
fixWebpackSourcePaths: true | ||
}, | ||
reporters: ['progress', 'kjhtml'], | ||
port: 9876, | ||
colors: true, | ||
logLevel: config.LOG_INFO, | ||
autoWatch: true, | ||
browsers: ['Chrome'], | ||
singleRun: false, | ||
restartOnFileChange: true | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json", | ||
"dest": "../../dist/social-login-buttons", | ||
"lib": { | ||
"entryFile": "src/public-api.ts" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{ | ||
"name": "@angular-cool/social-login-buttons", | ||
"version": "2.0.0", | ||
"description": "Cool social login buttons for angular", | ||
"peerDependencies": { | ||
"@angular/common": "^9.0.0", | ||
"@angular/core": "^9.0.0", | ||
"tslib": "^1.10.0" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/Hacklone/angular-cool.git" | ||
}, | ||
"keywords": [ | ||
"angular2", | ||
"angular", | ||
"social", | ||
"login", | ||
"sign-in", | ||
"google", | ||
"button" | ||
], | ||
"author": "Hacklone <[email protected]>", | ||
"license": "MIT", | ||
"licenses": [ | ||
{ | ||
"type": "MIT", | ||
"url": "https://github.com/Hacklone/angular-cool/raw/master/LICENSE" | ||
} | ||
], | ||
"bugs": { | ||
"url": "https://github.com/Hacklone/angular-cool/issues" | ||
}, | ||
"homepage": "https://github.com/Hacklone/angular-cool/blob/master/projects/social-login-buttons/README.md" | ||
} |
19 changes: 19 additions & 0 deletions
19
projects/social-login-buttons/src/lib/cool-social-login-buttons.module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { NgModule } from '@angular/core'; | ||
|
||
import { CommonModule } from '@angular/common'; | ||
import { CoolGoogleButtonComponent } from './google-button/cool-google-button.component'; | ||
|
||
@NgModule({ | ||
imports: [ | ||
CommonModule, | ||
], | ||
providers: [], | ||
declarations: [ | ||
CoolGoogleButtonComponent, | ||
], | ||
exports: [ | ||
CoolGoogleButtonComponent, | ||
], | ||
}) | ||
export class CoolSocialLoginButtonsModule { | ||
} |
18 changes: 18 additions & 0 deletions
18
projects/social-login-buttons/src/lib/google-button/cool-google-button.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<button type="button" class="google-button" | ||
[class.disabled]="disabled" | ||
[class.light]="style === 'light'" | ||
[class.dark]="style === 'dark'" | ||
(click)="onClick($event)"> | ||
<span class="icon"> | ||
<svg viewBox="0 0 366 372" xmlns="http://www.w3.org/2000/svg"><path | ||
d="M125.9 10.2c40.2-13.9 85.3-13.6 125.3 1.1 22.2 8.2 42.5 21 59.9 37.1-5.8 6.3-12.1 12.2-18.1 18.3l-34.2 34.2c-11.3-10.8-25.1-19-40.1-23.6-17.6-5.3-36.6-6.1-54.6-2.2-21 4.5-40.5 15.5-55.6 30.9-12.2 12.3-21.4 27.5-27 43.9-20.3-15.8-40.6-31.5-61-47.3 21.5-43 60.1-76.9 105.4-92.4z" | ||
id="Shape" fill="#EA4335"/><path | ||
d="M20.6 102.4c20.3 15.8 40.6 31.5 61 47.3-8 23.3-8 49.2 0 72.4-20.3 15.8-40.6 31.6-60.9 47.3C1.9 232.7-3.8 189.6 4.4 149.2c3.3-16.2 8.7-32 16.2-46.8z" | ||
id="Shape" fill="#FBBC05"/><path | ||
d="M361.7 151.1c5.8 32.7 4.5 66.8-4.7 98.8-8.5 29.3-24.6 56.5-47.1 77.2l-59.1-45.9c19.5-13.1 33.3-34.3 37.2-57.5H186.6c.1-24.2.1-48.4.1-72.6h175z" | ||
id="Shape" fill="#4285F4"/><path | ||
d="M81.4 222.2c7.8 22.9 22.8 43.2 42.6 57.1 12.4 8.7 26.6 14.9 41.4 17.9 14.6 3 29.7 2.6 44.4.1 14.6-2.6 28.7-7.9 41-16.2l59.1 45.9c-21.3 19.7-48 33.1-76.2 39.6-31.2 7.1-64.2 7.3-95.2-1-24.6-6.5-47.7-18.2-67.6-34.1-20.9-16.6-38.3-38-50.4-62 20.3-15.7 40.6-31.5 60.9-47.3z" | ||
fill="#34A853"/></svg> | ||
</span> | ||
<span class="text"><ng-content></ng-content></span> | ||
</button> |
78 changes: 78 additions & 0 deletions
78
projects/social-login-buttons/src/lib/google-button/cool-google-button.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
.google-button { | ||
height: 36px; | ||
background-color: #4285f4; | ||
border: 1px solid #4285f4; | ||
color: #fff; | ||
border-radius: 5px; | ||
white-space: nowrap; | ||
box-shadow: 1px 1px 0 1px rgba(0, 0, 0, 0.05); | ||
transition-property: background-color, box-shadow; | ||
transition-duration: 150ms; | ||
transition-timing-function: ease-in-out; | ||
padding: 0; | ||
|
||
cursor: pointer; | ||
|
||
&.dark { | ||
background-color: #4285f4; | ||
border: 1px solid #4285f4; | ||
|
||
color: #fff; | ||
} | ||
|
||
&.light { | ||
background-color: #fff; | ||
border: 1px solid #fff; | ||
|
||
color: #757575; | ||
} | ||
|
||
&:focus, | ||
&:active, | ||
&:hover { | ||
outline: 0; | ||
} | ||
|
||
&:not(.disabled) { | ||
&:focus, | ||
&:active, | ||
&:hover { | ||
box-shadow: 1px 4px 5px 1px rgba(0, 0, 0, 0.1); | ||
} | ||
} | ||
|
||
&.disabled { | ||
cursor: default; | ||
|
||
background-color: rgba(0, 0, 0, 0.12); | ||
box-shadow: 0px 0px 0px 0px rgba(0, 0, 0, 0.2), 0px 0px 0px 0px rgba(0, 0, 0, 0.14), 0px 0px 0px 0px rgba(0, 0, 0, 0.12); | ||
border-color: #eee; | ||
color: rgba(0, 0, 0, 0.26); | ||
|
||
.icon { | ||
background-color: #eee; | ||
} | ||
} | ||
|
||
.icon { | ||
display: inline-block; | ||
vertical-align: middle; | ||
width: 40px; | ||
height: 100%; | ||
padding: 4px 12px; | ||
box-sizing: border-box; | ||
|
||
border-top-left-radius: 5px; | ||
border-bottom-left-radius: 5px; | ||
|
||
background-color: #fff; | ||
} | ||
|
||
.text { | ||
display: inline-block; | ||
vertical-align: middle; | ||
padding: 0 10px 0 10px; | ||
font-size: 14px; | ||
font-weight: 500; | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
projects/social-login-buttons/src/lib/google-button/cool-google-button.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { ChangeDetectionStrategy, Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'cool-google-button', | ||
templateUrl: './cool-google-button.component.html', | ||
styleUrls: ['./cool-google-button.component.scss'], | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
}) | ||
export class CoolGoogleButtonComponent implements OnInit { | ||
|
||
constructor() { } | ||
|
||
@Input() | ||
public disabled: boolean; | ||
|
||
@Input() | ||
public style: 'dark' | 'light' = 'dark'; | ||
|
||
@Output() | ||
public click: EventEmitter<MouseEvent> = new EventEmitter<MouseEvent>(); | ||
|
||
ngOnInit() { | ||
} | ||
|
||
public onClick(event: MouseEvent) { | ||
if (this.disabled) { | ||
return; | ||
} | ||
|
||
this.click.emit(event); | ||
|
||
event.stopPropagation(); | ||
event.preventDefault(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/* | ||
* Public API Surface of social-login-buttons | ||
*/ | ||
|
||
export * from './lib/google-button/cool-google-button.component'; | ||
export * from './lib/cool-social-login-buttons.module'; |
Oops, something went wrong.