This repository has been archived by the owner on Sep 20, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7ebf16a
commit ee25cf8
Showing
7 changed files
with
160 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Cryptic Components | ||
|
||
|
||
Style classes : | ||
- primary | ||
- success | ||
- warning | ||
- danger | ||
- info | ||
|
||
--- | ||
|
||
## Button | ||
|
||
### Example | ||
|
||
```html | ||
<app-styled-button (click)="login()" flavor="primary" [disabled]="!form.valid">Log in</app-styled-button> | ||
``` | ||
|
||
--- | ||
|
||
## Radio Button | ||
|
||
### Example | ||
|
||
```html | ||
// ADD EXAMPLES FOR ALL THE DEFAULT COMPONENTS // | ||
``` | ||
|
||
--- |
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 @@ | ||
<button [disabled]="disabled" (click)="onClick.emit($event)" [class]="flavor"><ng-content></ng-content></button> |
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,59 @@ | ||
@use "sass:list"; | ||
@import "theme-colors"; | ||
|
||
$flavors: ( | ||
primary: ( | ||
$primary-default, | ||
$primary-hover, | ||
$primary-disabled, | ||
), | ||
success: ( | ||
$success-default, | ||
$success-hover, | ||
$success-disabled, | ||
), | ||
warning: ( | ||
$warning-default, | ||
$warning-hover, | ||
$warning-disabled, | ||
), | ||
danger: ( | ||
$danger-default, | ||
$danger-hover, | ||
$danger-disabled, | ||
), | ||
info: ( | ||
$info-default, | ||
$info-hover, | ||
$info-disabled, | ||
), | ||
); | ||
|
||
button { | ||
padding: 10px; | ||
border-radius: 10px; | ||
width: 100%; | ||
color: white; | ||
border: none; | ||
font-size: 16px; | ||
margin-right: 10px; | ||
&:last-child { | ||
margin-right: 0; | ||
} | ||
|
||
@each $name, $colors in $flavors { | ||
&.#{$name} { | ||
color: #2f2f36; | ||
background: list.nth($colors, 1); | ||
|
||
&:disabled { | ||
background-color: list.nth($colors, 3); | ||
} | ||
|
||
&:hover { | ||
background-color: list.nth($colors, 2); | ||
color: white; | ||
} | ||
} | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
src/app/design/styled-button/styled-button.component.spec.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,25 @@ | ||
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { StyledButtonComponent } from './styled-button.component'; | ||
|
||
describe('StyledButtonComponent', () => { | ||
let component: StyledButtonComponent; | ||
let fixture: ComponentFixture<StyledButtonComponent>; | ||
|
||
beforeEach(async(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [ StyledButtonComponent ] | ||
}) | ||
.compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(StyledButtonComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
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,17 @@ | ||
import { Component, EventEmitter, Input, Output } from '@angular/core'; | ||
|
||
export type ButtonFlavor = 'primary' | 'success' | 'warning' | 'danger' | 'info'; | ||
|
||
@Component({ | ||
selector: 'app-styled-button', | ||
templateUrl: './styled-button.component.html', | ||
styleUrls: ['./styled-button.component.scss'] | ||
}) | ||
export class StyledButtonComponent { | ||
|
||
@Input() public disabled = false; | ||
@Input() public flavor: ButtonFlavor = 'primary'; | ||
|
||
// tslint:disable-next-line: no-output-on-prefix | ||
@Output() public onClick = new EventEmitter<MouseEvent>(); | ||
} |
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,24 @@ | ||
/*primary*/ | ||
$primary-default: #2ECC70; | ||
$primary-hover: #1F8C4C; | ||
$primary-disabled: #2E473E; | ||
/*success*/ | ||
$success-default: #3ABB18; | ||
$success-hover: #277A10; | ||
$success-disabled: #2F5629; | ||
/*warning*/ | ||
$warning-default: #F1C30E; | ||
$warning-hover: #B3910B; | ||
$warning-disabled: #675926; | ||
/*danger*/ | ||
$danger-default: #F00040; | ||
$danger-hover: #B0002F; | ||
$danger-disabled: #671E35; | ||
/*info*/ | ||
$info-default: #3281F6; | ||
$info-hover: #245EB5; | ||
$info-disabled: #2D456C; | ||
/*etc*/ | ||
$logo-crypt: #27A036 | ||
/* ISSUE : #260 */ | ||
|