-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(components): enable theming of SCION components
SCION provides a set of design tokens to enable consistent design and theming of SCION components. Design tokens are provided by the `@scion/components` SCSS module in the form of a light and dark theme. Applications can customize or replace the built-in themes. See [SCION Design Tokens](https://github.com/SchweizerischeBundesbahnen/scion-toolkit/blob/master/docs/site/scion-design-tokens.md) for more information. BREAKING CHANGE: Theming of SCION components has introduced deprecations that will break in the next major release. To migrate: - Import the `@scion/components` SCSS module in `styles.scss`. Optionally, pass a configuration to customize the default look of SCION components or to support multiple themes. See [SCION Design Tokens](https://github.com/SchweizerischeBundesbahnen/scion-toolkit/blob/master/docs/site/scion-design-tokens.md) for more information. Note that this step is not required if using `@scion/workbench` as imported by the SCION Workbench. - For consistency, following CSS variables for styling the `sci-splitter` and `sci-sashbox` components have been renamed: - `--sci-splitter-bgcolor` ➜ `--sci-splitter-background-color` - `--sci-splitter-bgcolor_hover` ➜ `--sci-splitter-background-color-hover` - `--sci-splitter-size_hover` ➜ `--sci-splitter-size-hover` - `--sci-splitter-opacity_active` ➜ `--sci-splitter-opacity-active` - `--sci-splitter-opacity_hover` ➜ `--sci-splitter-opacity-hover` - `--sci-sashbox-splitter-bgcolor` ➜ `--sci-sashbox-splitter-background-color` - `--sci-sashbox-splitter-size_hover` ➜ `--sci-sashbox-splitter-size-hover` - `--sci-sashbox-splitter-opacity_hover` ➜ `--sci-sashbox-splitter-opacity-hover` - `--sci-sashbox-splitter-bgcolor_hover` ➜ `--sci-sashbox-splitter-background-color-hover` - `--sci-sashbox-splitter-opacity_active` ➜ `--sci-sashbox-splitter-opacity-active` - Scrollbar-related mixins have been moved to the `@scion/components/scrollbar` SCSS module. Migrate as follows: **Before:** ```scss @use '@scion/components' as sci-components; @include sci-components.scrollbar-hide-when-inactive() @include sci-components.scrollbar-position() ``` **After:** ```scss @use '@scion/components/scrollbar' as sci-scrollbar; @include sci-scrollbar.scrollbar-hide-when-inactive() @include sci-scrollbar.scrollbar-position() ```
- Loading branch information
1 parent
9fed733
commit a24c3a4
Showing
114 changed files
with
2,408 additions
and
1,313 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
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
58 changes: 31 additions & 27 deletions
58
apps/components/src/app/sci-accordion-page/sci-accordion-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 |
---|---|---|
@@ -1,32 +1,36 @@ | ||
<h1>sci-accordion (ɵ)</h1> | ||
<main> | ||
<h1>sci-accordion (ɵ)</h1> | ||
|
||
<form [formGroup]="form"> | ||
<section class="settings"> | ||
<header>Settings</header> | ||
<sci-accordion [variant]="form.controls.variant.value" [multi]="form.controls.multi.value"> | ||
<ng-container *ngFor="let item of items"> | ||
<!-- item --> | ||
<ng-template sciAccordionItem [panel]="panel"> | ||
<header>{{item.title}}</header> | ||
</ng-template> | ||
|
||
<sci-form-field label="Variant"> | ||
<select [formControl]="form.controls.variant"> | ||
<option value="solid">solid</option> | ||
<option value="bubble">bubble</option> | ||
</select> | ||
</sci-form-field> | ||
<!-- item panel --> | ||
<ng-template #panel> | ||
{{item.description}} | ||
</ng-template> | ||
</ng-container> | ||
</sci-accordion> | ||
</main> | ||
|
||
<sci-form-field label="Multi"> | ||
<sci-checkbox [formControl]="form.controls.multi"></sci-checkbox> | ||
</sci-form-field> | ||
</section> | ||
</form> | ||
<aside [formGroup]="form"> | ||
<sci-tabbar> | ||
<ng-template sciTab label="Settings"> | ||
<div class="tab"> | ||
<sci-form-field label="Variant"> | ||
<select [formControl]="form.controls.variant"> | ||
<option value="solid">solid</option> | ||
<option value="bubble">bubble</option> | ||
</select> | ||
</sci-form-field> | ||
|
||
<sci-accordion [variant]="form.controls.variant.value" [multi]="form.controls.multi.value"> | ||
<ng-container *ngFor="let item of items"> | ||
<!-- item --> | ||
<ng-template sciAccordionItem [panel]="panel"> | ||
<header>{{item.title}}</header> | ||
<sci-form-field label="Multi"> | ||
<sci-checkbox [formControl]="form.controls.multi"></sci-checkbox> | ||
</sci-form-field> | ||
</div> | ||
</ng-template> | ||
|
||
<!-- item panel --> | ||
<ng-template #panel> | ||
{{item.description}} | ||
</ng-template> | ||
</ng-container> | ||
</sci-accordion> | ||
</sci-tabbar> | ||
</aside> |
50 changes: 17 additions & 33 deletions
50
apps/components/src/app/sci-accordion-page/sci-accordion-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 |
---|---|---|
@@ -1,44 +1,28 @@ | ||
@mixin panel { | ||
display: grid; | ||
gap: 1em; | ||
grid-template-columns: 1fr; | ||
grid-auto-rows: max-content; | ||
border: 1px solid var(--sci-color-P400); | ||
border-radius: 5px; | ||
padding: 1em; | ||
|
||
> header { | ||
font-weight: bold; | ||
margin-bottom: 1em; | ||
} | ||
} | ||
|
||
:host { | ||
display: flex; | ||
flex-direction: column; | ||
|
||
> h1 { | ||
flex: none; | ||
} | ||
gap: 1em; | ||
|
||
> form { | ||
flex: none; | ||
display: grid; | ||
grid-auto-rows: max-content; | ||
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); | ||
> main { | ||
flex: auto; | ||
display: flex; | ||
flex-direction: column; | ||
gap: 1em; | ||
margin-bottom: 2em; | ||
|
||
> section.settings { | ||
@include panel; | ||
} | ||
} | ||
|
||
> sci-accordion { | ||
> aside { | ||
flex: none; | ||
display: grid; | ||
border: 1px solid var(--sci-color-border); | ||
border-radius: var(--sci-corner); | ||
background-color: var(--sci-color-background-secondary); | ||
padding: 1em; | ||
min-width: 350px; | ||
|
||
&.solid header { | ||
font-weight: bold; | ||
> sci-tabbar div.tab { | ||
display: flex; | ||
flex-direction: column; | ||
gap: 1em; | ||
padding: .25em; | ||
} | ||
} | ||
} |
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
21 changes: 16 additions & 5 deletions
21
apps/components/src/app/sci-checkbox-page/sci-checkbox-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 |
---|---|---|
@@ -1,7 +1,18 @@ | ||
<h1>sci-checkbox (ɵ)</h1> | ||
<main> | ||
<h1>sci-checkbox (ɵ)</h1> | ||
|
||
<h2>enabled</h2> | ||
<sci-checkbox [disabled]="false"></sci-checkbox> | ||
<sci-checkbox [formControl]="form.controls.checkbox"></sci-checkbox> | ||
</main> | ||
|
||
<h2>disabled</h2> | ||
<sci-checkbox [disabled]="true"></sci-checkbox> | ||
<aside [formGroup]="form"> | ||
<sci-tabbar> | ||
<ng-template sciTab label="State"> | ||
<div class="tab"> | ||
<label> | ||
<sci-checkbox [formControl]="form.controls.state.controls.disabled"></sci-checkbox> | ||
Disabled | ||
</label> | ||
</div> | ||
</ng-template> | ||
</sci-tabbar> | ||
</aside> |
Oops, something went wrong.