Skip to content
This repository has been archived by the owner on Sep 20, 2023. It is now read-only.

Base Components #346

Draft
wants to merge 24 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
e89f955
Added Button Base Component (#275)
ClientCrash Mar 6, 2022
529d501
Fixed merge conflicts
MarcelCoding Mar 14, 2022
c69a13d
Added Button Base Component (#275)
ClientCrash Mar 6, 2022
428be30
Fixed merge conflicts
MarcelCoding Mar 14, 2022
7cc9f7b
Creates Base-Components-Page with lazy-loading. (#358)
Tristan-H11 Mar 21, 2022
71178d1
Renamed button to "design-button".
Tristan-H11 Mar 21, 2022
7ec4ae7
Added testing page for design-button. (#358)
Tristan-H11 Mar 21, 2022
95b487f
Fixed design-button being animated while disabled.
Tristan-H11 Mar 21, 2022
2a71c44
Changes ES-Lint to allow the "design"-prefix in the component-selector.
Tristan-H11 Mar 22, 2022
2ccb1ff
Added the color-variables for fonts, backgrounds and popUps. (#260)
Tristan-H11 Mar 22, 2022
140f93a
Set new radius for the button. (#260)
Tristan-H11 Mar 22, 2022
56ddecf
Fixed background. (#358)
Tristan-H11 Mar 22, 2022
1a729fe
Grouped colors. (#260)
Tristan-H11 Mar 22, 2022
7724400
Fixed Fontsize. (#260)
Tristan-H11 Mar 22, 2022
a798dc7
Added outline-buttons. (#279)
Tristan-H11 Mar 22, 2022
1a10220
Added cursor-behaviour. (#279)
Tristan-H11 Mar 22, 2022
58a1134
Added text-only button. (#279)
Tristan-H11 Mar 22, 2022
a05098a
Moved Buttons into buttons-dir and fixed some paddings. (#279)
Tristan-H11 Mar 22, 2022
07e2f63
Improved Base-Components showcase page. (#260)
Tristan-H11 Mar 22, 2022
9c6950a
Cloudflare trigger.
Tristan-H11 Mar 23, 2022
e330e27
Added Jost and set default size to 20px. (#260)
Tristan-H11 Mar 23, 2022
86df925
Fixed button colors. (#279)
Tristan-H11 Mar 23, 2022
5c1450d
Added progress bar (#363)
ClientCrash May 14, 2022
5df05e6
Merge branch 'master' into issue/260-base-components
MarcelCoding Sep 8, 2022
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 .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"error",
{
"type": "element",
"prefix": "app",
"prefix": ["app", "design"],
"style": "kebab-case"
}
],
Expand Down
31 changes: 31 additions & 0 deletions ComponentDocs.md
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 //
```

---
11 changes: 11 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"@angular/platform-browser": "~13.2.5",
"@angular/platform-browser-dynamic": "~13.2.5",
"@angular/router": "~13.2.5",
"@fontsource/jost": "^4.5.4",
"@sentry/angular": "^6.18.2",
"ng-particles": "^2.40.2",
"rxjs": "~7.5.0",
Expand Down
1 change: 1 addition & 0 deletions src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const routes: Routes = [
{path: '', loadChildren: () => import('./control-center/control-center.module').then(m => m.ControlCenterModule)},
{path: 'desktop', loadChildren: () => import('./desktop/desktop.module').then(m => m.DesktopModule)},
{path: '', loadChildren: () => import('./account/account.module').then(m => m.AccountModule)},
{ path: 'design', loadChildren: () => import('./base-components/base-components.module').then(m => m.BaseComponentsModule) },
{path: '**', redirectTo: '/'}
];

Expand Down
11 changes: 11 additions & 0 deletions src/app/base-components/base-components-routing.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { BaseComponentsComponent } from './base-components.component';

const routes: Routes = [{ path: '', component: BaseComponentsComponent }];

@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule]
})
export class BaseComponentsRoutingModule { }
109 changes: 109 additions & 0 deletions src/app/base-components/base-components.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
<div class="page">
<div class="componentContainer">
<h2>Buttons - Primary</h2>
<design-button (click)="pressedAlert('Primary')" [disabled]="false" flavor="primary" class="component">
Primary
</design-button>
<design-button [disabled]="true" flavor="primary" class="component">
Primary disabled
</design-button>
<design-button (click)="pressedAlert('Success')" [disabled]="false" flavor="success" class="component">
Success
</design-button>
<design-button [disabled]="true" flavor="success" class="component">
Success disabled
</design-button>
<design-button (click)="pressedAlert('Warning')" [disabled]="false" flavor="warning" class="component">
Warning
</design-button>
<design-button [disabled]="true" flavor="warning" class="component">
Warning disabled
</design-button>
<design-button (click)="pressedAlert('Danger')" [disabled]="false" flavor="danger" class="component">
Danger
</design-button>
<design-button [disabled]="true" flavor="danger" class="component">
Danger disabled
</design-button>
<design-button (click)="pressedAlert('Info')" [disabled]="false" flavor="info" class="component">
Info
</design-button>
<design-button [disabled]="true" flavor="info" class="component">
Info disabled
</design-button>
</div>
<div class="componentContainer">
<h2>Buttons - Outlined</h2>
<design-button-outline (click)="pressedAlert('Primary')" [disabled]="false" flavor="primary" class="component">
Primary
</design-button-outline>
<design-button-outline [disabled]="true" flavor="primary" class="component">
Primary disabled
</design-button-outline>
<design-button-outline (click)="pressedAlert('Success')" [disabled]="false" flavor="success" class="component">
Success
</design-button-outline>
<design-button-outline [disabled]="true" flavor="success" class="component">
Success disabled
</design-button-outline>
<design-button-outline (click)="pressedAlert('Warning')" [disabled]="false" flavor="warning" class="component">
Warning
</design-button-outline>
<design-button-outline [disabled]="true" flavor="warning" class="component">
Warning disabled
</design-button-outline>
<design-button-outline (click)="pressedAlert('Danger')" [disabled]="false" flavor="danger" class="component">
Danger
</design-button-outline>
<design-button-outline [disabled]="true" flavor="danger" class="component">
Danger disabled
</design-button-outline>
<design-button-outline (click)="pressedAlert('Info')" [disabled]="false" flavor="info" class="component">
Info
</design-button-outline>
<design-button-outline [disabled]="true" flavor="info" class="component">
Info disabled
</design-button-outline>
</div>
<div class="componentContainer">
<h2>Buttons - Text only</h2>
<design-button-text (click)="pressedAlert('Primary')" [disabled]="false" flavor="primary" class="component">
Primary
</design-button-text>
<design-button-text [disabled]="true" flavor="primary" class="component">
Primary disabled
</design-button-text>
<design-button-text (click)="pressedAlert('Success')" [disabled]="false" flavor="success" class="component">
Success
</design-button-text>
<design-button-text [disabled]="true" flavor="success" class="component">
Success disabled
</design-button-text>
<design-button-text (click)="pressedAlert('Warning')" [disabled]="false" flavor="warning" class="component">
Warning
</design-button-text>
<design-button-text [disabled]="true" flavor="warning" class="component">
Warning disabled
</design-button-text>
<design-button-text (click)="pressedAlert('Danger')" [disabled]="false" flavor="danger" class="component">
Danger
</design-button-text>
<design-button-text [disabled]="true" flavor="danger" class="component">
Danger disabled
</design-button-text>
<design-button-text (click)="pressedAlert('Info')" [disabled]="false" flavor="info" class="component">
Info
</design-button-text>
<design-button-text [disabled]="true" flavor="info" class="component">
Info disabled
</design-button-text>

</div>

<div class="componentContainer">
<h2>Progressbar</h2>
<design-progressbar></design-progressbar>
<design-progressbar value="50"></design-progressbar>
<design-progressbar value="0"></design-progressbar>
</div>
<!-- Cloudflare trigger -->
17 changes: 17 additions & 0 deletions src/app/base-components/base-components.component.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
.componentContainer {
display: inline-grid;
width: 300px;
margin: 30px;
padding: 1em;
border: 3px solid #ffffff;
}

.component {
padding-bottom: 10px;
}

.page {
height: 100%;
overflow: auto;
background: #2F2F36;
}
25 changes: 25 additions & 0 deletions src/app/base-components/base-components.component.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { BaseComponentsComponent } from './base-components.component';

describe('BaseComponentsComponent', () => {
let component: BaseComponentsComponent;
let fixture: ComponentFixture<BaseComponentsComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ BaseComponentsComponent ]
})
.compileComponents();
});

beforeEach(() => {
fixture = TestBed.createComponent(BaseComponentsComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
15 changes: 15 additions & 0 deletions src/app/base-components/base-components.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { Component } from '@angular/core';

@Component({
selector: 'app-base-components',
templateUrl: './base-components.component.html',
styleUrls: ['./base-components.component.scss']
})
export class BaseComponentsComponent {

constructor() { }

pressedAlert(name: string) {
alert(name + " was pressed!");
}
}
24 changes: 24 additions & 0 deletions src/app/base-components/base-components.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { ProgressbarModule } from './../../core/components/progressbar/progressbar.module';
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';

import { BaseComponentsRoutingModule } from './base-components-routing.module';
import { BaseComponentsComponent } from './base-components.component';
import {ButtonModule} from "../../core/components/buttons/button/button.module";
import {ButtonOutlineModule} from "../../core/components/buttons/button-outline/button-outline.module";
import {ButtonTextModule} from "../../core/components/buttons/button-text/button-text.module";

@NgModule({
declarations: [
BaseComponentsComponent,
],
imports: [
CommonModule,
BaseComponentsRoutingModule,
ButtonModule,
ButtonOutlineModule,
ButtonTextModule,
ProgressbarModule
]
})
export class BaseComponentsModule { }
8 changes: 8 additions & 0 deletions src/core/components/buttons/_buttons.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
$b-padding: 8px;
$b-border-radius: 8px;
$b-width: 100%;
$b-color: white;
$b-border: none;
$b-font-size: 20px;
$b-margin-right: 10px;
$b-cursor: pointer;
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<button (click)="onClick.emit($event)" [class]="flavor" [disabled]="disabled">
<ng-content></ng-content>
</button>
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
@use "sass:list";
@import "src/global-styles/theme-colors";
@import "../buttons";

$flavors: (
primary: (
$primary-default,
$primary-disabled,
),
success: (
$success-default,
$success-disabled,
),
warning: (
$warning-default,
$warning-disabled,
),
danger: (
$danger-default,
$danger-disabled,
),
info: (
$info-default,
$info-disabled,
),
);

button {
padding: 6px;
background: none;
border: 2px solid;
border-radius: $b-border-radius;
width: $b-width;
color: $b-color;
font-size: $b-font-size;
margin-right: $b-margin-right;
cursor: $b-cursor;


&:last-child {
margin-right: 0;
}

@each $name, $colors in $flavors {
&.#{$name} {
border-color: list.nth($colors, 1);
color: list.nth($colors, 1);

&:disabled {
border-color: list.nth($colors, 2);
color: list.nth($colors, 2);
cursor: default;
}

&:hover:not([disabled]) {
border-color: list.nth($colors, 1);
background: list.nth($colors, 1);
@if $name == "danger" or $name == "info" {
color: $light-font;
} @else {
color: $dark-font;
}
}
}
}
}
Loading