-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* divider implementation * enhance readme * update composition page * added left border to table expanded row contents according to design guidelines
- Loading branch information
Showing
13 changed files
with
203 additions
and
17 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
"components": { | ||
"CpsDividerComponent": { | ||
"description": "CpsDividerComponent is a component that can be used to separate content.", | ||
"props": { | ||
"description": "Defines the input properties of the component.", | ||
"values": [ | ||
{ | ||
"name": "vertical", | ||
"optional": false, | ||
"readonly": false, | ||
"type": "InputSignal<boolean>", | ||
"default": "...", | ||
"description": "Determines whether the divider is vertically aligned." | ||
}, | ||
{ | ||
"name": "color", | ||
"optional": false, | ||
"readonly": false, | ||
"type": "InputSignal<string>", | ||
"default": "...", | ||
"description": "Color of the divider." | ||
}, | ||
{ | ||
"name": "thickness", | ||
"optional": false, | ||
"readonly": false, | ||
"type": "InputSignal<string | number>", | ||
"default": "...", | ||
"description": "Thickness of the divider, a number denoting pixels or a string." | ||
} | ||
] | ||
} | ||
} | ||
} | ||
} |
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
22 changes: 22 additions & 0 deletions
22
projects/composition/src/app/pages/divider-page/divider-page.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,22 @@ | ||
<app-component-docs-viewer [componentData]="componentData"> | ||
<h2 class="section-title">Horizontal divider</h2> | ||
<div> | ||
<p>First row</p> | ||
<cps-divider></cps-divider> | ||
<p>Second row</p> | ||
</div> | ||
<h2 class="section-title">Vertical divider</h2> | ||
<div class="vertical-section"> | ||
<p>First column</p> | ||
<cps-divider [vertical]="true"></cps-divider> | ||
<p>Second column</p> | ||
<cps-divider [vertical]="true"></cps-divider> | ||
<p>Third column</p> | ||
</div> | ||
<h2 class="section-title">Custom thick and red divider</h2> | ||
<div> | ||
<p>First row</p> | ||
<cps-divider thickness="4" color="red"></cps-divider> | ||
<p>Second row</p> | ||
</div> | ||
</app-component-docs-viewer> |
15 changes: 15 additions & 0 deletions
15
projects/composition/src/app/pages/divider-page/divider-page.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,15 @@ | ||
:host { | ||
.section-title { | ||
color: var(--cps-color-calm); | ||
margin-top: 0; | ||
} | ||
|
||
.section-title:not(:first-child) { | ||
margin-top: 48px; | ||
} | ||
|
||
.vertical-section { | ||
display: flex; | ||
column-gap: 12px; | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
projects/composition/src/app/pages/divider-page/divider-page.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,17 @@ | ||
import { Component } from '@angular/core'; | ||
import { CpsDividerComponent } from 'cps-ui-kit'; | ||
import { ComponentDocsViewerComponent } from '../../components/component-docs-viewer/component-docs-viewer.component'; | ||
|
||
import ComponentData from '../../api-data/cps-divider.json'; | ||
|
||
@Component({ | ||
selector: 'app-divider-page', | ||
standalone: true, | ||
imports: [CpsDividerComponent, ComponentDocsViewerComponent], | ||
templateUrl: './divider-page.component.html', | ||
styleUrl: './divider-page.component.scss', | ||
host: { class: 'composition-page' } | ||
}) | ||
export class DividerPageComponent { | ||
componentData = ComponentData; | ||
} |
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 |
---|---|---|
|
@@ -11,6 +11,7 @@ | |
- Chip | ||
- Datepicker | ||
- Dialog | ||
- Divider | ||
- Expansion panel | ||
- File upload | ||
- Icon | ||
|
7 changes: 7 additions & 0 deletions
7
projects/cps-ui-kit/src/lib/components/cps-divider/cps-divider.component.cy.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,7 @@ | ||
import { CpsDividerComponent } from './cps-divider.component'; | ||
|
||
describe('CpsDividerComponent', () => { | ||
it('should mount', () => { | ||
cy.mount(CpsDividerComponent); | ||
}); | ||
}); |
12 changes: 12 additions & 0 deletions
12
projects/cps-ui-kit/src/lib/components/cps-divider/cps-divider.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,12 @@ | ||
.cps-divider { | ||
display: block; | ||
margin: 0; | ||
|
||
&.cps-divider-horizontal { | ||
border-top-style: solid; | ||
} | ||
|
||
&.cps-divider-vertical { | ||
border-right-style: solid; | ||
} | ||
} |
49 changes: 49 additions & 0 deletions
49
projects/cps-ui-kit/src/lib/components/cps-divider/cps-divider.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,49 @@ | ||
import { Component, ViewEncapsulation, computed, input } from '@angular/core'; | ||
import { getCSSColor } from '../../utils/colors-utils'; | ||
import { convertSize } from '../../utils/internal/size-utils'; | ||
|
||
/** | ||
* CpsDividerComponent is a component that can be used to separate content. | ||
* @group Components | ||
*/ | ||
@Component({ | ||
selector: 'cps-divider', | ||
host: { | ||
class: 'cps-divider', | ||
'[class.cps-divider-vertical]': 'vertical()', | ||
'[class.cps-divider-horizontal]': '!vertical()', | ||
'[style.border-color]': '_dividerColor()', | ||
'[style.border-width]': '_dividerThickness()' | ||
}, | ||
standalone: true, | ||
template: '', | ||
styleUrl: './cps-divider.component.scss', | ||
encapsulation: ViewEncapsulation.None | ||
}) | ||
export class CpsDividerComponent { | ||
/** | ||
* Determines whether the divider is vertically aligned. | ||
* @group Props | ||
*/ | ||
vertical = input(false); | ||
|
||
/** | ||
* Color of the divider. | ||
* @group Props | ||
*/ | ||
color = input('line-mid'); | ||
|
||
/** | ||
* Thickness of the divider, a number denoting pixels or a string. | ||
* @group Props | ||
*/ | ||
thickness = input<number | string>('1px'); | ||
|
||
private _dividerColor = computed(() => { | ||
return getCSSColor(this.color()); | ||
}); | ||
|
||
private _dividerThickness = computed(() => { | ||
return convertSize(this.thickness()); | ||
}); | ||
} |
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