@ng-zen/cli 0.0.1-alpha.1 → 19.0.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/LICENSE +24 -24
  2. package/README.md +46 -39
  3. package/package.json +12 -13
  4. package/schematics/collection.json +16 -16
  5. package/schematics/components/components-generator.js.map +1 -1
  6. package/schematics/components/components-generator.ts +7 -0
  7. package/schematics/components/files/avatar/avatar.component.scss +23 -23
  8. package/schematics/components/files/avatar/avatar.component.spec.ts +22 -22
  9. package/schematics/components/files/avatar/avatar.component.ts +66 -60
  10. package/schematics/components/files/avatar/avatar.stories.ts +38 -0
  11. package/schematics/components/files/avatar/index.ts +1 -1
  12. package/schematics/components/files/button/button.component.scss +42 -42
  13. package/schematics/components/files/button/button.component.spec.ts +22 -22
  14. package/schematics/components/files/button/button.component.ts +25 -11
  15. package/schematics/components/files/button/button.stories.ts +19 -0
  16. package/schematics/components/files/button/index.ts +1 -10
  17. package/schematics/components/index.js +4 -14
  18. package/schematics/components/index.js.map +1 -1
  19. package/schematics/components/index.ts +10 -0
  20. package/schematics/components/schema.json +30 -25
  21. package/schematics/components/templates/README.md.template +40 -41
  22. package/schematics/ng-add/index.js +3 -4
  23. package/schematics/ng-add/index.js.map +1 -1
  24. package/schematics/ng-add/index.ts +14 -0
  25. package/schematics/ng-add/ng-zen-generator.js.map +1 -1
  26. package/schematics/ng-add/ng-zen-generator.ts +3 -0
  27. package/schematics/ng-add/schema.json +15 -15
  28. package/types/generator-schema-base.interface.js +3 -0
  29. package/types/generator-schema-base.interface.js.map +1 -0
  30. package/types/generator-schema-base.interface.ts +4 -0
  31. package/types/index.js +5 -0
  32. package/types/index.js.map +1 -0
  33. package/types/index.ts +1 -0
  34. package/types/schematics-folder.type.js +3 -0
  35. package/types/schematics-folder.type.js.map +1 -0
  36. package/types/schematics-folder.type.ts +3 -0
  37. package/{schematics/utils → utils}/add-path-to-tsconfig.util.js +2 -3
  38. package/utils/add-path-to-tsconfig.util.js.map +1 -0
  39. package/utils/add-path-to-tsconfig.util.ts +50 -0
  40. package/utils/apply-file-template.util.js +23 -0
  41. package/utils/apply-file-template.util.js.map +1 -0
  42. package/utils/apply-file-template.util.ts +26 -0
  43. package/utils/index.js +6 -0
  44. package/utils/index.js.map +1 -0
  45. package/utils/index.ts +2 -0
  46. package/CHANGELOG.md +0 -28
  47. package/schematics/components/components-generator.d.ts +0 -5
  48. package/schematics/components/components-generator.d.ts.map +0 -1
  49. package/schematics/components/files/badge/badge.component.scss +0 -70
  50. package/schematics/components/files/badge/badge.component.spec.ts +0 -22
  51. package/schematics/components/files/badge/badge.component.ts +0 -52
  52. package/schematics/components/files/badge/index.ts +0 -1
  53. package/schematics/components/files/pin/index.ts +0 -1
  54. package/schematics/components/files/pin/pin.component.scss +0 -29
  55. package/schematics/components/files/pin/pin.component.spec.ts +0 -22
  56. package/schematics/components/files/pin/pin.component.ts +0 -46
  57. package/schematics/components/files/switch/index.ts +0 -10
  58. package/schematics/components/files/switch/zen-switch.component.html +0 -11
  59. package/schematics/components/files/switch/zen-switch.component.scss +0 -62
  60. package/schematics/components/files/switch/zen-switch.component.spec.ts +0 -22
  61. package/schematics/components/files/switch/zen-switch.component.ts +0 -123
  62. package/schematics/components/files/tag/index.ts +0 -10
  63. package/schematics/components/files/tag/tag.component.scss +0 -9
  64. package/schematics/components/files/tag/tag.component.spec.ts +0 -22
  65. package/schematics/components/files/tag/tag.component.ts +0 -26
  66. package/schematics/components/index.d.ts +0 -4
  67. package/schematics/components/index.d.ts.map +0 -1
  68. package/schematics/ng-add/index.d.ts +0 -4
  69. package/schematics/ng-add/index.d.ts.map +0 -1
  70. package/schematics/ng-add/ng-zen-generator.d.ts +0 -4
  71. package/schematics/ng-add/ng-zen-generator.d.ts.map +0 -1
  72. package/schematics/utils/add-path-to-tsconfig.util.d.ts +0 -3
  73. package/schematics/utils/add-path-to-tsconfig.util.d.ts.map +0 -1
  74. package/schematics/utils/add-path-to-tsconfig.util.js.map +0 -1
package/LICENSE CHANGED
@@ -1,24 +1,24 @@
1
- BSD 2-Clause License
2
-
3
- Copyright (c) 2024, Konrad Stępień
4
-
5
- Redistribution and use in source and binary forms, with or without
6
- modification, are permitted provided that the following conditions are met:
7
-
8
- 1. Redistributions of source code must retain the above copyright notice, this
9
- list of conditions and the following disclaimer.
10
-
11
- 2. Redistributions in binary form must reproduce the above copyright notice,
12
- this list of conditions and the following disclaimer in the documentation
13
- and/or other materials provided with the distribution.
14
-
15
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
19
- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
21
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
22
- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
23
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1
+ BSD 2-Clause License
2
+
3
+ Copyright (c) 2024, Konrad Stępień
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are met:
7
+
8
+ 1. Redistributions of source code must retain the above copyright notice, this
9
+ list of conditions and the following disclaimer.
10
+
11
+ 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ this list of conditions and the following disclaimer in the documentation
13
+ and/or other materials provided with the distribution.
14
+
15
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
19
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
21
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
22
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
23
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package/README.md CHANGED
@@ -1,39 +1,46 @@
1
- # @ng-zen/cli
2
-
3
- ## Overview
4
-
5
- The ng-zen CLI is a command-line tool designed to facilitate the generation of UI-kit elements for Angular applications using Angular schematics. It provides out-of-the-box components that can be quickly integrated into Angular projects.
6
-
7
- ## Installation
8
-
9
- To install ng-zen CLI, use the following command:
10
-
11
- ```bash
12
- ng add @ng-zen/cli
13
- ```
14
-
15
- This command will add the necessary dependencies and configurations to your Angular project.
16
-
17
- ## Generating Components
18
-
19
- You can generate components using the ng-zen CLI. Components are generated using the following command format:
20
-
21
- ```bash
22
- ng generate @ng-zen/cli:component
23
- ```
24
-
25
- ## License
26
-
27
- This project is licensed under the BSD 2-Clause License. For more details, refer to the LICENSE file in the repository.
28
-
29
-
30
- ## Author
31
-
32
- **@ng-zen/cli** is maintained by Konrad Stępień.
33
-
34
- - Email: kord.stp@gmail.com
35
- - LinkedIn: [Konrad Stępień](https://www.linkedin.com/in/konradstepien/)
36
-
37
- ## Documentation
38
-
39
- The ng-zen CLI is documented using Storybook for component examples and JSDoc, as well as Compodoc for Angular project documentation.
1
+ # @ng-zen/cli
2
+
3
+ ## Overview
4
+
5
+ The ng-zen CLI is a command-line tool designed to facilitate the generation of UI-kit elements for Angular applications using Angular schematics. It provides out-of-the-box components that can be quickly integrated into Angular projects.
6
+
7
+ ## Installation
8
+
9
+ To install ng-zen CLI, use the following command:
10
+
11
+ ```bash
12
+ ng add @ng-zen/cli
13
+ ```
14
+
15
+ This command will add the necessary dependencies and configurations to your Angular project.
16
+
17
+ ## Generating
18
+
19
+ You can generate code using the ng-zen CLI.
20
+
21
+ #### Components
22
+
23
+ ```bash
24
+ ng generate @ng-zen/cli:component
25
+ ```
26
+
27
+ #### Directives
28
+
29
+ ```bash
30
+ ng generate @ng-zen/cli:directive
31
+ ```
32
+
33
+ ## License
34
+
35
+ This project is licensed under the BSD 2-Clause License. For more details, refer to the LICENSE file in the repository.
36
+
37
+ ## Author
38
+
39
+ **@ng-zen/cli** is maintained by Konrad Stępień.
40
+
41
+ - Email: kord.stp@gmail.com
42
+ - LinkedIn: [Konrad Stępień](https://www.linkedin.com/in/konradstepien/)
43
+
44
+ ## Documentation
45
+
46
+ The ng-zen CLI is documented using Storybook for component examples and JSDoc, as well as Compodoc for Angular project documentation.
package/package.json CHANGED
@@ -1,8 +1,10 @@
1
1
  {
2
2
  "name": "@ng-zen/cli",
3
- "version": "0.0.1-alpha.1",
3
+ "version": "19.0.0-alpha.2",
4
+ "description": "A blank schematics",
4
5
  "license": "BSD-2-Clause",
5
6
  "private": false,
7
+ "builders": "./builders/builders.json",
6
8
  "repository": {
7
9
  "url": "https://github.com/Kordrad/ng-zen",
8
10
  "directory": "projects/cli"
@@ -15,24 +17,21 @@
15
17
  "email": "kord.stp@gmail.com",
16
18
  "url": "https://www.linkedin.com/in/KonradStepien/"
17
19
  },
18
- "schematics": "./schematics/collection.json",
20
+ "keywords": [
21
+ "schematics"
22
+ ],
19
23
  "ng-add": {
20
24
  "save": "devDependencies"
21
25
  },
26
+ "schematics": "./schematics/collection.json",
22
27
  "peerDependencies": {
23
- "@angular/common": "^17.3.0",
24
- "@angular/core": "^17.3.0"
28
+ "@angular/common": "^19.1.6",
29
+ "@angular/core": "^19.1.6"
25
30
  },
26
31
  "dependencies": {
27
- "@angular-devkit/core": "^17.3.0",
28
- "@angular-devkit/schematics": "^17.3.0",
32
+ "@angular-devkit/core": "^19.1.6",
33
+ "@angular-devkit/schematics": "^19.1.6",
29
34
  "tslib": "^2.3.0"
30
35
  },
31
- "devDependencies": {
32
- "@chromatic-com/storybook": "^1.3.5",
33
- "@storybook/addon-essentials": "^8.1.0",
34
- "@storybook/addon-interactions": "^8.1.0",
35
- "@storybook/addon-links": "^8.1.0"
36
- },
37
36
  "sideEffects": false
38
- }
37
+ }
@@ -1,16 +1,16 @@
1
- {
2
- "$schema": "../../../node_modules/@angular-devkit/schematics/collection-schema.json",
3
- "schematics": {
4
- "ng-add": {
5
- "description": "Add library to the project.",
6
- "factory": "./ng-add/index#ngAdd",
7
- "schema": "./ng-add/schema.json"
8
- },
9
- "component": {
10
- "description": "This schematic generates ui components",
11
- "factory": "./components/index#componentGenerator",
12
- "schema": "./components/schema.json",
13
- "aliases": ["c"]
14
- }
15
- }
16
- }
1
+ {
2
+ "$schema": "../../../../node_modules/@angular-devkit/schematics/collection-schema.json",
3
+ "schematics": {
4
+ "ng-add": {
5
+ "description": "Add library to the project.",
6
+ "factory": "./ng-add/index#ngAdd",
7
+ "schema": "./ng-add/schema.json"
8
+ },
9
+ "component": {
10
+ "description": "This schematic generates ui components",
11
+ "factory": "./components/index#componentGenerator",
12
+ "schema": "./components/schema.json",
13
+ "aliases": ["c"]
14
+ }
15
+ }
16
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"components-generator.js","sourceRoot":"","sources":["../../../../../projects/cli/schematics/components/components-generator.ts"],"names":[],"mappings":"","sourcesContent":["export interface ComponentGeneratorSchema {\r\n components: ('avatar' | 'badge' | 'button' | 'pin' | 'switch' | 'tag')[];\r\n path: string;\r\n}\r\n"]}
1
+ {"version":3,"file":"components-generator.js","sourceRoot":"","sources":["../../../../../projects/cli/src/schematics/components/components-generator.ts"],"names":[],"mappings":"","sourcesContent":["import { GeneratorSchemaBase } from '../../types';\n\nexport type ComponentType = 'avatar' | 'button';\n\nexport interface ComponentGeneratorSchema extends GeneratorSchemaBase {\n components: ComponentType[];\n}\n"]}
@@ -0,0 +1,7 @@
1
+ import { GeneratorSchemaBase } from '../../types';
2
+
3
+ export type ComponentType = 'avatar' | 'button';
4
+
5
+ export interface ComponentGeneratorSchema extends GeneratorSchemaBase {
6
+ components: ComponentType[];
7
+ }
@@ -1,23 +1,23 @@
1
- zen-avatar {
2
- height: 32px;
3
- width: 32px;
4
- position: relative;
5
- display: flex;
6
- justify-content: center;
7
- align-items: center;
8
- border-radius: 50%;
9
- overflow: hidden;
10
- touch-action: none;
11
- pointer-events: none;
12
- user-select: none;
13
-
14
- // Text
15
- &:not(:has(img)) {
16
- background-color: #6b7280;
17
- }
18
-
19
- & > * {
20
- height: 100%;
21
- width: 100%;
22
- }
23
- }
1
+ $size: var(--zen-avatar-size, 32px);
2
+ $bg-color: var(--zen-avatar-bg-color, #d3d3d3);
3
+ $color: var(--zen-avatar-color, #0f172a);
4
+ $font-size: var(--zen-avatar-font-size, small);
5
+
6
+ :host {
7
+ display: flex;
8
+ height: $size;
9
+ width: $size;
10
+ border-radius: 50%;
11
+ overflow: hidden;
12
+ position: relative;
13
+
14
+ // Content styles
15
+ background-color: $bg-color;
16
+ color: $color;
17
+ font-size: $font-size;
18
+ justify-content: center;
19
+ align-items: center;
20
+ font-weight: bold;
21
+ text-align: center;
22
+ user-select: none;
23
+ }
@@ -1,22 +1,22 @@
1
- import { ComponentFixture, TestBed } from '@angular/core/testing';
2
-
3
- import { ZenAvatarComponent } from './avatar.component';
4
-
5
- describe('ZenAvatarComponent', () => {
6
- let component: ZenAvatarComponent;
7
- let fixture: ComponentFixture<ZenAvatarComponent>;
8
-
9
- beforeEach(async () => {
10
- await TestBed.configureTestingModule({
11
- imports: [ZenAvatarComponent],
12
- }).compileComponents();
13
-
14
- fixture = TestBed.createComponent(ZenAvatarComponent);
15
- component = fixture.componentInstance;
16
- fixture.detectChanges();
17
- });
18
-
19
- it('should create', () => {
20
- expect(component).toBeTruthy();
21
- });
22
- });
1
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
2
+
3
+ import { ZenAvatarComponent } from './avatar.component';
4
+
5
+ describe('ZenAvatarComponent', () => {
6
+ let component: ZenAvatarComponent;
7
+ let fixture: ComponentFixture<ZenAvatarComponent>;
8
+
9
+ beforeEach(async () => {
10
+ await TestBed.configureTestingModule({
11
+ imports: [ZenAvatarComponent],
12
+ }).compileComponents();
13
+
14
+ fixture = TestBed.createComponent(ZenAvatarComponent);
15
+ component = fixture.componentInstance;
16
+ fixture.detectChanges();
17
+ });
18
+
19
+ it('should create', () => {
20
+ expect(component).toBeTruthy();
21
+ });
22
+ });
@@ -1,60 +1,66 @@
1
- import { NgOptimizedImage } from '@angular/common';
2
- import {
3
- ChangeDetectionStrategy,
4
- Component,
5
- input,
6
- ViewEncapsulation,
7
- } from '@angular/core';
8
-
9
- /**
10
- * A component to display an avatar image. If a valid image source URL is provided,
11
- * it will render an image element. Otherwise, it will display projected content.
12
- *
13
- * The component uses Angular's optimized image directives for enhanced performance.
14
- *
15
- * Usage:
16
- *
17
- * ```html
18
- * <!-- If an image source is provided, it will display the image -->
19
- * <zen-avatar [src]="'/path/to/image.jpg'" />
20
- *
21
- * <!-- If no image source is provided, it will display the projected content -->
22
- * <zen-avatar> A </zen-avatar>
23
- * ```
24
- *
25
- * @example
26
- * <zen-avatar src="https://picsum.photos/32" />
27
- *
28
- * @component
29
- * @selector `zen-avatar`
30
- *
31
- * @license BSD-2-Clause
32
- * @author Konrad Stępień <kord.stp@gmail.com>
33
- * @link https://github.com/Kordrad/ng-zen
34
- */
35
- @Component({
36
- selector: 'zen-avatar',
37
- standalone: true,
38
- imports: [NgOptimizedImage],
39
- template: `
40
- @if (src()) {
41
- <img [ngSrc]="src()" alt="" fill />
42
- } @else {
43
- <ng-content />
44
- }
45
- `,
46
- styleUrl: './avatar.component.scss',
47
- encapsulation: ViewEncapsulation.None,
48
- changeDetection: ChangeDetectionStrategy.OnPush,
49
- })
50
- export class ZenAvatarComponent {
51
- /**
52
- * Path to the image source. If the `src` is provided, an image element will be rendered.
53
- * Otherwise, the content projected into this component will be displayed.
54
- *
55
- * @default ''
56
- * @input
57
- * @type string
58
- */
59
- readonly src = input<string>('');
60
- }
1
+ import { NgOptimizedImage } from '@angular/common';
2
+ import { ChangeDetectionStrategy, Component, input } from '@angular/core';
3
+
4
+ /**
5
+ * A component to display an avatar image.
6
+ * If a valid image source URL is provided, it will render an image element.
7
+ * Otherwise, it will display projected content.
8
+ *
9
+ * This component utilizes Angular's optimized image directives for enhanced performance.
10
+ *
11
+ * ### Usage
12
+ *
13
+ * To use the component, you can provide an image source or project content:
14
+ *
15
+ * ```html
16
+ * <!-- If an image source is provided, it will display the image -->
17
+ * <zen-avatar [src]="'/path/to/image.jpg'" />
18
+ *
19
+ * <!-- If no image source is provided, it will display the projected content -->
20
+ * <zen-avatar> A </zen-avatar>
21
+ * ```
22
+ *
23
+ * ### CSS Custom Properties
24
+ *
25
+ * You can customize the avatar using CSS custom properties:
26
+ *
27
+ * ```css
28
+ * zen-avatar {
29
+ * --zen-avatar-size: 16px;
30
+ * --zen-avatar-bg-color: black;
31
+ * --zen-avatar-color: white;
32
+ * --zen-avatar-font-size: small;
33
+ * }
34
+ * ```
35
+ *
36
+ * @example
37
+ * <zen-avatar src="https://picsum.photos/32" />
38
+ *
39
+ * @author Konrad Stępień
40
+ * @license {@link https://github.com/Kordrad/ng-zen?tab=BSD-2-Clause-1-ov-file|BSD-2-Clause}
41
+ * @see [GitHub](https://github.com/Kordrad/ng-zen)
42
+ */
43
+ @Component({
44
+ selector: 'zen-avatar',
45
+ imports: [NgOptimizedImage],
46
+ template: `
47
+ @if (src()) {
48
+ <img [alt]="alt()" [ngSrc]="src()" fill onerror="console.log('test')" />
49
+ } @else {
50
+ <ng-content />
51
+ }
52
+ `,
53
+ styleUrl: './avatar.component.scss',
54
+ changeDetection: ChangeDetectionStrategy.OnPush,
55
+ })
56
+ export class ZenAvatarComponent {
57
+ /**
58
+ * Name of the source image. Image name will be processed by the image loader,
59
+ * and the final URL will be applied as the src property of the image.
60
+ */
61
+ readonly src = input<string>('');
62
+ /**
63
+ * Sets or retrieves a text alternative to the graphic.
64
+ */
65
+ readonly alt = input<string>('');
66
+ }
@@ -0,0 +1,38 @@
1
+ import type { Meta, StoryObj } from '@storybook/angular';
2
+
3
+ import { ZenAvatarComponent } from './avatar.component';
4
+
5
+ export default {
6
+ title: 'Components/Avatar',
7
+ component: ZenAvatarComponent,
8
+ tags: ['autodocs'],
9
+ render: args => ({ props: { ...args } }),
10
+ } satisfies Meta<ZenAvatarComponent>;
11
+
12
+ type Story = StoryObj<ZenAvatarComponent>;
13
+
14
+ export const Image: Story = {
15
+ args: {
16
+ src: 'https://picsum.photos/32',
17
+ },
18
+ };
19
+
20
+ export const Default: Story = {
21
+ render: () => ({
22
+ template: `
23
+ <zen-avatar src="https://github.com/Kordrad.png" alt="Author" style="--zen-avatar-size: 64px"/>
24
+ `,
25
+ }),
26
+ };
27
+
28
+ export const Text: Story = {
29
+ render: () => ({
30
+ template: `
31
+ <div style="display: flex; gap: 1rem;">
32
+ <zen-avatar>MI</zen-avatar>
33
+ <zen-avatar>IB</zen-avatar>
34
+ <zen-avatar>WP</zen-avatar>
35
+ <zen-avatar>AI</zen-avatar>
36
+ </div> `,
37
+ }),
38
+ };
@@ -1 +1 @@
1
- export * from './avatar.component';
1
+ export * from './avatar.component';
@@ -1,42 +1,42 @@
1
- $bg-color-hover: #333;
2
- $bg-color: #000;
3
- $color: #fff;
4
- $padding: 8px 24px;
5
- $shadow-hover: 0 0 0 3px rgb(0 123 255 / 50%);
6
- $shadow: 0 2px 4px rgb(0 0 0 / 10%);
7
- $transition-duration: 0.4s;
8
-
9
- :host {
10
- display: inline-block;
11
- font-size: 14px;
12
- font-weight: bold;
13
- text-align: center;
14
- cursor: pointer;
15
- border: none;
16
- padding: $padding;
17
- border-radius: 99999px;
18
- transition: all $transition-duration ease;
19
- background-color: $bg-color;
20
- color: $color;
21
- box-shadow: $shadow;
22
- text-decoration: none;
23
- outline: none;
24
- overflow: hidden;
25
- position: relative;
26
- }
27
-
28
- /* Hover state */
29
- :host:hover {
30
- background-color: $bg-color-hover;
31
- }
32
-
33
- /* Focus state */
34
- :host:focus {
35
- box-shadow: $shadow-hover;
36
- }
37
-
38
- /* Disabled state */
39
- :host[disabled] {
40
- cursor: not-allowed;
41
- opacity: 0.6;
42
- }
1
+ $bg-color-hover: #333;
2
+ $bg-color: #000;
3
+ $color: #fff;
4
+ $padding: 8px 24px;
5
+ $shadow-hover: 0 0 0 3px rgb(0 123 255 / 50%);
6
+ $shadow: 0 2px 4px rgb(0 0 0 / 10%);
7
+ $transition-duration: 0.4s;
8
+
9
+ :host {
10
+ display: inline-block;
11
+ font-size: 14px;
12
+ font-weight: bold;
13
+ text-align: center;
14
+ cursor: pointer;
15
+ border: none;
16
+ padding: $padding;
17
+ border-radius: 99999px;
18
+ transition: all $transition-duration ease;
19
+ background-color: $bg-color;
20
+ color: $color;
21
+ box-shadow: $shadow;
22
+ text-decoration: none;
23
+ outline: none;
24
+ overflow: hidden;
25
+ position: relative;
26
+ }
27
+
28
+ /* Hover state */
29
+ :host:hover {
30
+ background-color: $bg-color-hover;
31
+ }
32
+
33
+ /* Focus state */
34
+ :host:focus {
35
+ box-shadow: $shadow-hover;
36
+ }
37
+
38
+ /* Disabled state */
39
+ :host[aria-disabled='true'] {
40
+ cursor: not-allowed;
41
+ opacity: 0.6;
42
+ }
@@ -1,22 +1,22 @@
1
- import { ComponentFixture, TestBed } from '@angular/core/testing';
2
-
3
- import { ZenButtonComponent } from './button.component';
4
-
5
- describe('ButtonComponent', () => {
6
- let component: ZenButtonComponent;
7
- let fixture: ComponentFixture<ZenButtonComponent>;
8
-
9
- beforeEach(async () => {
10
- await TestBed.configureTestingModule({
11
- imports: [ZenButtonComponent],
12
- }).compileComponents();
13
-
14
- fixture = TestBed.createComponent(ZenButtonComponent);
15
- component = fixture.componentInstance;
16
- fixture.detectChanges();
17
- });
18
-
19
- it('should create', () => {
20
- expect(component).toBeTruthy();
21
- });
22
- });
1
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
2
+
3
+ import { ZenButtonComponent } from './button.component';
4
+
5
+ describe('ButtonComponent', () => {
6
+ let component: ZenButtonComponent;
7
+ let fixture: ComponentFixture<ZenButtonComponent>;
8
+
9
+ beforeEach(async () => {
10
+ await TestBed.configureTestingModule({
11
+ imports: [ZenButtonComponent],
12
+ }).compileComponents();
13
+
14
+ fixture = TestBed.createComponent(ZenButtonComponent);
15
+ component = fixture.componentInstance;
16
+ fixture.detectChanges();
17
+ });
18
+
19
+ it('should create', () => {
20
+ expect(component).toBeTruthy();
21
+ });
22
+ });